
output templates
The nits.format switch allows control of output format. It takes a file name. The format of that text file is a sequence of fixed section names, enclosed in square brackets on their own lines, each optionally followed by text. In that text, certain specific identifiers, enclosed in brace pairs, are substituted. For example:
[dog-section]
My dog {{dog-name}} is a {{bad-dog}}.
For examples, browse recipe/toast/output/*.nit in the source.
Inside the double brace brackets, a macro identifier may optionally be followed by two additional pieces of text, separated by colons. If the content of the macro text is not empty, then, when it is output, it is preceded by the first of those texts, and followed by the second. For example:
My dog {{dog-name:“:”}}
If no file is specified, or if the file cannot be loaded, a default template is used.
Note also the nits.quote switch.
Dylan Harris
April 2025