drj826 / SML

This is the Perl 5 implementation of the SML code library. SML is a minimalistic plain text descriptive markup language which is human readable, enables continuous integration of documentation, expresses and validates semantic relationships, is easy to edit, is easy to generate automatically, and publishes professional documentation from plain text manuscripts.
GNU General Public License v3.0
2 stars 2 forks source link

Lookup References in Header and Footer Elements not Resolving #60

Closed drj826 closed 8 years ago

drj826 commented 8 years ago

When I put a lookup reference in a header or footer element, it does not get resolved. For instance:

header_left:: [lookup:date:sml-ug]

should place the date of the SML User Guide document (ID = sml-ug) in the left header. But the lookup reference does not get resolved and

[lookup:date:sml-ug]
is displayed instead.

drj826 commented 8 years ago

This is actually not a problem. The problem is that I was not writing the template correctly to retrieve the looked up value. Here's an example of how to do it right. Consider the following document. Notice the 'header_left' element:

>>>DOCUMENT.sml-ug
title:: Semantic Manuscript Language (SML)
subtitle:: User Guide
abbreviation:: UG
author:: Don Johnson
copyright:: 2002-2015, Don Johnson
doctype:: book
header_left:: [lookup:date:sml-ug]
logo_image_small:: files/images/sml_logo.png
logo_image_center:: files/images/meadow.jpg
version:: v2.0
.
.
.

The correct way to access the header value in a template is:

[%- IF library.has_property(document_id,'header_left') -%]
[%- header_left_element = library.get_first_property_value_element(document_id,'header_left') -%]
[% INCLUDE part_list.tt self = header_left_element %]
[%- END -%]