Introduction to creating your own templates
Template uses an advanced, yet simple, template system to allows you to create and modify the content to be copied to the clipboard. The syntax is really straight-forward and consists of the following categories;
Tags are always surrounded by curly braces like this {name}
and
output the value of the named variable. If that value is undefined or falsey
it will simply be deleted.
Values are not escaped by default and, in order to do so, you must use double
braces like this {{name}}
. This will escape &
<
>
"
'
characters
so that the final output can be safely copied in to XML
and HTML.
Sections are always surrounded by opening and closing tags like this {#name}...{/name}
and can be used for the following purposes;
Inverted sections are very similar to normal sections but are written like this
{^name}...{/name}
and can be used in for the following purposes;
Nested properties of objects can also be accessed using dot notation like {name.nested}
which would get the nested property of the name object. These
expressions can be even chained to access properties of nested properties and
so on.
The names of simple tags and sections are case-insensitive, therefore {name}
will output the same as {NaMe}
. However, sections must be opened
and closed with names in the same case (i.e. {#name}...{/NaMe}
will
not work).
If you are having problems with understanding this guide please let us know and we will try to help you and take your comments on board, updating the documentation if required.
If you encounter any problems while using Template and/or would like to see a change or addition, please raise a ticket and we will have a look at it.
For more examples, try looking at the predefined templates.