TemplateEngine class
The TemplateEngine can:
- Parse the Template text into a parser tree
- Render the parser tree to a output such as:
Features
- Template expressions that can contain (combinations of):
- Data types
- Constants
- Variables
- Operators
- Functions
e.g. functions to import:
- Pure files (to be imported as is)
- Template files (to be parsed and rendered)
- XML files (to be used as a data source)
- JSON files (to be used as a data source)
- YAML files (to be used as a data source)
- All of the above can be customized or you could add your own.
Constructors
-
TemplateEngine.new({List<
DataType< ? dataTypes, List<Object> >Constant> ? constants, List<OperatorGroup> ? operatorGroups, List<FunctionGroup> ? functionGroups, List<Tag< ? tags, String tagStart = '{{', String tagEnd = '}}'})Object> >
Properties
-
constants
→ List<
Constant> -
final
-
dataTypes
→ List<
DataType< Object> > -
final
-
functionGroups
→ List<
FunctionGroup> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
operatorGroups
→ List<
OperatorGroup> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tagEnd ↔ String
-
The tag ends with given suffix.
Use a suffix combination that is not used elsewhere in your templates.
e.g.: Do not use > as a suffix if your template contains HTML or XML
By default the prefix is: }}
Examples of other prefixes and suffixes:
getter/setter pair
-
If null it will use
StandardTagParsers
final - tagStart → String
-
The tag starts with given prefix.
Use a prefix combination that is not used elsewhere in your templates.
e.g.: Do not use < as a prefix if your template contains HTML or XML
By default the prefix is: {{
Examples of other prefixes and suffixes:
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseTemplate(
Template template) → Future< ParseResult> - Parse the Template text into a parser tree. See Renderer
-
parseTemplates(
List< Template> templates) → Future<ParseResult> - Parse text from Templates into a parser tree. See Renderer
-
parseText(
String text) → Future< ParseResult> -
render(
ParseResult parseResults, [VariableMap? variables]) → Future< RenderResult> - Render the parser tree to a string (and write it as files when needed)
-
toString(
) → String -
A string representation of this object.
inherited
-
validateNamesAreUnique(
) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited