14.1 Templates

A recfmt template is a text string that may contain template slots. Those slots are substituted in the template using the information of a given record. Any text that is not within a slot is copied literally to the output.

Slots are written surrounded by double curly braces, like:

{{...}}

Slots contain selection expressions, that are executed every time the template is applied to a record. The slot is then replaced by the string representation of the value returned by the expression.

For example, consider the following template:

Task {{Id}}: {{Summary}}
------------------------
{{Description}}
--
Created at {{CreatedAt}}

When applied to the following record:

Id: 123
Summary: Fix recfmt.
CreatedAt: 12 December 2010
Description:
+ The recfmt tool shall be fixed, because right
+ now it is leaking 200 megabytes per processed record.

The result is:

Task 123: Fix recfmt.
------------------------
The recfmt tool shall be fixed, because right
now it is leaking 200 megabytes per processed record.
--
Created at 12 December 2010

You can use any selection expression in the slots, including conditionals and string concatenation.