Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The autoescape tag can be used to temporarily disable/re-enable the autoescaper as well as change the escaping strategy for a portion of the template.

Example

{% autoescape "js" %}

${content}

{% endautoescape %}

Anchor
_block
_block
block

A section that can be overridden by a child template.

Template

{% block "${blockName}" %}

${content}

{% endblock %}

Anchor
_extends
_extends
extends

...

The filter tag allows you to apply a filter to a large chunk of template.

Template

{% filter ${filter} %}
${content}
{% endfilter %}

Template 2

{% filter ${filter1}

| ${filter2} %}

${content}

{% endfilter %}

Anchor
_for
_for
for

The for tag is used to iterate through a collection or map.

Template

{% for ${i} in ${collection} %}

${content}

{% endfor %}

Anchor
_for_else
_for_else
for else

The for tag is used to iterate through a collection or map with a convenient way to check for emptiness.

Template

{% for ${i} in ${collection} %}

${content}

{% else %}

${content}

{% endfor %}

Anchor
_if
_if
if

The if tag allows you to designate a chunk of content as conditional depending on the result of an expression.

Template

{% if ${condition} %}

${content}

{% endif %}

Anchor
_if_else
_if_else
if else

The if tag allows you to designate a chunk of content as conditional depending on the result of an expression.

Template

{% if ${condition} %}

${content}

{% else %}

${content}

{% endif %}

Anchor
_if_elseif
_if_elseif
if elseif

The if tag allows you to designate a chunk of content as conditional depending on the result of an expression.

Template

{% if ${condition} %}

${content}

{% elseif %}

${content}

{% else %}

${content}

{% endif %}

Anchor
_import
_import
import

The import tag allows you to use macros defined in another template.

Template

{% import "${templateName}" %}

Anchor
_include
_include
include

The include tag allows you to insert the rendered output of another template directly into the current template. The included template will have access to the same variables that the current template does.

Template

{% include "${templateName}" %}

Anchor
_include_with
_include_with
include with

The include tag allows you to insert the rendered output of another template directly into the current template. The included template will have access to the same variables that the current template does with additional variables.

Template

{% include "${templateName}" with { ${mapOfVariables} } %}

Anchor
_macro
_macro
macro

The macro tag allows you to create a chunk of reusable and dynamic content. The macro can be called multiple times in the current template or even from another template with the help of the import tag.

Example

{% macro concat(left, right) %}

{{ left }} {{ right }}

{% endmacro %}

Anchor
_parallel
_parallel
parallel

The parallel tag allows you to designate a chunk of content to be rendered using a new thread.

Template

{% parallel %}

${content}

{% endparallel %}

Anchor
_set
_set
set

The set tag allows you to define a variable in the current context, whether it currently exists or not.
Will initialize the variable or override the current value in the variable.

Template

{% set ${variable} = ${value} %}

Anchor
_verbatim
_verbatim
verbatim

...