{{> pathOrExpr }} |
get the HTML-encoded value of the data path or expression, and insert it into the rendered output |
{{>address.street}} |
{{!-- ... --}} |
comments to templates, or commenting out sections of a template |
{{!-- this is a comment --}} |
{{: pathOrExpr }} |
get the value of the data path or expression, and insert it into the rendered output as a string |
{{:address.street}} |
{{include tmpl=nameOrExpr /}} |
template composition: Iinclude the referenced template: tmpl, rendered using the current data context |
{{:name}} lives in {{include tmpl="#addressTemplate"/}} |
{{for pathOrExpr tmpl=nameOrExpr /}} |
template composition: render the referenced external template using the specified object or array |
{{for billing.address tmpl="addressTmpl" /}} |
{{for pathOrExpr }} ... {{/for}} |
template composition: render the block content of the {{for}} tag using the object or array specified by the path or expression as data context. |
{{for billing.address}} {{:city}} {{/for}} |
{{else ... }} |
acts as a separator, to divide the content of a tag into two or more different content blocks; {{else}} can be used with {{if}} , {{for}} or any custom tag |
{{for members}} Member Name: {{:name}} {{else}} There are currently no member {{/for}} |
{{if pathOrExpr tmpl=nameOrExpr /}} |
conditional inclusion: render the referenced external template only if the data-path or expression evaluates to true |
{{if nickname tmpl="nicknameTemplate" /}} |
{{if pathOrExpr1 tmpl=nameOrExpr1 }} {{else tmpl=nameOrExpr2 }} {{/if}} |
conditional inclusion: render different templates depending on one or more expressions |
={{if nickname tmpl="nicknameTemplate"}} {{else tmpl="noNicknameTemplate"}} {{/if}} = |
{{if pathOrExpr }} ... {{/if}} |
conditional inclusion: render the block content of the {{if}} tag only if the data-path or expression evaluates to true |
{{if nickname}} Nickname: {{:nickname}} {{/if}}) |
{{if pathOrExpr1 }} ... {{else pathOrExpr2}} ... {{else}} ... {{/if}} |
conditional blocks: render the first {{if}} or {{else}} block for which the expression is true; if none are true, and there is an {{else}} without an expression, render that block |
{{if nickname}} Nickname: {{:nickname}} {{else altnickname}} Alternate nickname: {{:altnickname}} {{else}} No nickname {{/if}} |
{{if ...}} ... {{else}} ... {{/if}} |
conditional inclusion: render the block content of the {{if}} tag if the expression is true, otherwise render the {{else}} block |
{{if nickname}} Nickname: {{:nickname}} {{else}} No nickname {/if}} |
{{props pathOrExpr tmpl=nameOrExpr /}} |
template composition: iterate over the properties of the object, and render the referenced external template once for each property -- using as data context {key: propertyName, prop: propertyValue} |
{{props billing.address tmpl="addressTmpl" /}} |
{{props pathOrExpr}} ... {{/props}} |
template composition: iterate over the properties of the object, and render the block content of the {{props}} tag (or the referenced external template) once for each property -- using as data context {key: propertyName, prop: propertyValue} |
{{props billing.address}} {{:key}}: {{:prop}} {{/props}} |