...
Statement type | Syntax | Comment | ||
---|---|---|---|---|
group |
| Place at beginning of string template group file to name the group, and also indicate inheritance or implements | ||
|
| Simple case. Conventionally, gname should match the name of the template group file (minus .stg extension). The actual StringTemplateGroup object's Name field adopts the name provided by this group statement, even if different from the filename. If other templates refer to this one (as in inheritance) then it's this gname that's valid. | ||
|
| Group gname inherits from supergroupname | ||
|
| Group gname implements the interface specified in intfname. Implements can also be placed after supergroupname. | ||
template |
| Basic form of template specification | ||
|
| Basic form of template specification using <<...>> to enclose multiple lines of template text | ||
|
| Declare formal arguments inside the parens. | ||
|
| Optionally provide a default value for an argument | ||
|
| Make newname an alternative name for the template oldname. Might also work for maps? | ||
Inheritance | Override an inherited template | In the sub group file, just create a new definition of the template using the syntax above. | ||
Region override |
| Override a region just like overriding a template, except use the qualified name of the region in place of the template name. Although there are parens, there will never be formal arguments. (<<...>> can be used instead of "...") | ||
map |
| -- The last row can use default as the name (no quotes) to specify what to return when an expression invokes the map with a key that is not in the map. | ||
|
|
...
Statement type | Syntax | Comment | ||
---|---|---|---|---|
interface |
| Place at beginning of string-template group interface file to name the interface | ||
|
| Simple case. Conventionally, gname should match the name of the template group file (minus .stg extension). The actual StringTemplateGroup object's Name field adopts the name provided by this group statement, even if different from the filename. If other templates refer to this one (as in inheritance) then it's this gname that's valid. | ||
|
| Specify a template that is required to be implemented. (Note the semicolon at the end.) | ||
|
| This form (with the keyword "optional") is used specify a template that can be implemented but is not required. |