04 Tags - domain-centric/template_engine GitHub Wiki
Tags are specific texts in templates that are replaced by the template_engine with other information.
A tag:
- Starts with some bracket and/or character combination, e.g.: {{
- Followed by some contents
- Ends with some closing bracket and/or character combination, e.g.: }}
A tag example: {{customer.name}}
By default the TemplateEngine tags start with {{ and end with }} brackets, just like the popular template engines Mustache and Handlebars.
You can also define alternative Tag brackets in the TemplateEngine constructor parameters. See TemplateEngine.tagStart and TemplateEngine.tagEnd
It is recommended to use a start and end combination that is not used elsewhere in your templates, e.g.: Do not use < > as Tag start and end if your template contains HTML or XML
The template_engine comes with DefaultTags. You can replace or add your own Tags by manipulating the the TemplateEngine.tags field.
description: | Evaluates an expression that can contain: * Data Types (e.g. boolean, number or String) * Constants (e.g. pi) * Variables (e.g. person.name ) * Operators (e.g. + - * /) * Functions (e.g. cos(7) ) * or any combination of the above |
|||
expression example: | The volume of a sphere = {{ round( (3/4) * pi * (radius ^ 3) )}}. | |||
code example: | tag_expression_parser_test.dart |