Metadata

< Syntax Layout >

Metadata

Metadata is the optional data in an embedded terp expression that controls the behavior of the text layout process. Metadata is used to control

  • text justification
  • text indentation
  • text margins
  • line width
  • linebreaking
  • treatment of end-of-line characters

When you expand a terp template, the terp environment is pre-populated with default values for all these properties. By embedding metadata, you can change the expansion behavior. Frequently, there's more than one way to achieve your desired formatting goal. For example, when attempting to right-align a string, you could temporarily switch the justification attribute to "right" or you could use a text formatter that uses a field width modifier.

Most metadata remains valid for a scope that is defined by the opening embedded statement and a closing statement, for example:

${#width=60 #center}This
is
centered
${end}This is left-aligned.

There are a few unscoped, embedded statements for which the definition of metadata makes sense, ${import()} for example. While import does not have a scope in the importing document, it defines the scope for the imported template contents, and that is what the metadata applies to.

The following table contains a complete list of supported metadata properties.

Built-in metadata properties
Name Default Comments
anchor none Remember current location as the dynamic indentation level for broken lines.
block see justify Shortcut for justify=block.
center see justify Shortcut for justify=center.
collapsews false Collapse multiple whitespaces into one, converting linebreaks into space.
eol Value of Java system property "line.separator" The value that is to be used for inserted linebreaks or for linebreak replacements when fixeol is true.
fixeol false Change end-of-line sequences to the value of the eol property.
foreach.prefix "" Prefix this string to the first element in the enumeration.
foreach.sep "" Put this string between all elements in an enumeration.
foreach.suffix "" Append this string to the last element in the enumeration.
indent 0 Line indentation from the left margin.
indent.default 4 The increment used when indent is used without an assignment, for example as in .
justify "left" Line justification.
left see justify Shortcut for justify=left.
linebreak false Break lines that do not fit the specified line width when taking margins and indent into account.
marginleft 0 The margin on the left, i.e. the number of empty spaces at the beginning of a line. Indentations are in addition to the left margin.
marginright 0 The margin on the right, i,e, the number of characters subtracted from the line width.
quiet false Suppresses the text output of any template contents within this scope if set to true. Variable assignments and other side effects of program execution are not suppressed.
right see justify Shortcut for justify=right.
width 80 The default line or "page" width in characters without counting end-of-line characters.

 


Copyright 2006-2016 by Codemesh, Inc., ALL RIGHTS RESERVED

:
terp template statements
codemesh.com home expressions templates ant about us contact us download   

Commandline