autoescape
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 |
|
block
A section that can be overridden by a child template.
Template |
|
extends
The extends tag is used to declare a parent template. It should be the very first tag used in a child template and a child template can only extend up to one parent template.
Template |
{% extends "${templateName}" %} |
filter
The filter tag allows you to apply a filter to a large chunk of template.
Template |
|
Template 2 |
{% filter ${filter1} | ${filter2} %} ${content} {% endfilter %} |
for
The for tag is used to iterate through a collection or map.
Template |
{% for ${i} in ${collection} %} ${content} {% endfor %} |
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 %} |
if
The if tag allows you to designate a chunk of content as conditional depending on the result of an expression.
Template |
|
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 %} |
if elseif
The if tag allows you to designate a chunk of content as conditional depending on the result of an expression.
Template |
|
import
The import tag allows you to use macros defined in another template.
Template |
|
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 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} } %} |
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 |
|
parallel
The parallel tag allows you to designate a chunk of content to be rendered using a new thread.
Template |
|
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 |
|
verbatim
The verbatim tag allows you to write Pebble syntax that won't be parsed.
Example |
{% verbatim %} |
br
The br tag adds a line break token at the current position.
Use an additional parameter to change the type of line break: lf (Default), crlf, other "token".
Template | |
{% br %} | " %} |
counter
The counter tag outputs an integer value that is incremented by one for each use.
Use the parameter local to make the counter increments per used template.
Example |
{% counter %} pencil |
Output |
1 pencil |
Example 2 |
Template "Other": {% counter local %} |
Outputs |
11 |
declare
The declare tag allows you to define a variable in the current context if it does not exist. If the variable does exist it will not be changed.
Note | |
---|---|
The following are the same: | |
{% declare encapsulation = true %} | default(true) %} |
Example |
{% set varA = "aa" %} |
Outputs |
aa cc |
error
The error tag allows you to fail generating the template with an error message, e.g. if something unexpected occurs.
Example |
{% if not requiredVar is defined %} |
indent
The indent tag adds one or more 4-space indents at the current position.
Example |
{% indent %} |
Example 2 |
{% indent 3 %} |
from
The from tag is used to iterate a subset of a collection defined by the where condition.
Template |
{% from ${collection} as ${var} where ${test} %} |
Example |
{% from range(1,10) as num where num is even %} |
Output |
2 |
from else
The from tag is used to iterate a subset of a collection defined by the where condition with a convenient way to check for emptiness.
Template |
{% from ${collection} as ${var} where ${test} %} |
Example | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="dabd2011-7538-4e2e-850b-fdf27eee36af"><ac:plain-text-body><![CDATA[ | {% from [] as num where num is even -%} |
Output | |
Empty collection |
list add
The list with add tag is used to append a value to a list.
Example | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0cedd645-de41-481c-a89d-983775d818d2"><ac:plain-text-body><![CDATA[ | {% set alphabet = ["a", "b", "c"] %} | |
Outputs | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c5170336-1e3f-4aea-9fa3-5f17a09f05fe"><ac:plain-text-body><![CDATA[ | [a, b, c] | ]]></ac:plain-text-body></ac:structured-macro> |
list adds
The list with add tag is used to append one or more values to a list.
Example | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2eaab83f-6c7e-450a-99a5-ba5ec9177c28"><ac:plain-text-body><![CDATA[ | {% set alphabet = ["a", "b", "c"] %} | |
Outputs | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f0bb21cb-27e4-45b7-ab38-bf21bafc80c8"><ac:plain-text-body><![CDATA[ | [a, b, c] | ]]></ac:plain-text-body></ac:structured-macro> |
list remove
The list with remove tag is used to remove a value from a list.
Example | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8f929fb2-961f-4c4c-834d-3c98a54b59bb"><ac:plain-text-body><![CDATA[ | {% set alphabet = ["a", "b", "c", "d", "e", "f"] %} | |
Outputs | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="071b402f-43b4-43b3-9bdf-af934b8edeff"><ac:plain-text-body><![CDATA[ | [a, b, c, d, e, f] | ]]></ac:plain-text-body></ac:structured-macro> |
list removes
The list with remove tag is used to remove one or more values from a list.
Example | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="dbe62065-cf99-438e-a145-ef5755c3622f"><ac:plain-text-body><![CDATA[ | {% set alphabet = ["a", "b", "c", "d", "e", "f"] %} | |
Outputs | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7e892a71-54a9-49f6-ba14-1e0de11f7a75"><ac:plain-text-body><![CDATA[ | [a, b, c, d, e, f] | ]]></ac:plain-text-body></ac:structured-macro> |
map put
The map put tag is used to set a key-value pair into a map, whether it currently exists or not.
Template |
{% map ${mapVar} put ${key} = ${value} %} |
map remove
The map remove tag is used to remove a key from a map.
Template |
{% map ${mapVar} remove ${key} %} |
placebottom
The placebottom tag allows defining a block in the template that will be placed at the end of the output. The priority argument defines the order of multiple place bottom blocks.
Template |
{% placebottom ${priority} %} |
get
The get tag defines a variable as a subset of a collection based on the given condition.
Example | ||
{% get evenNums from range(1,10) as num where num is even %} | ||
Output | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4c86ddba-be11-4ece-92f8-bbc1002b8a38"><ac:plain-text-body><![CDATA[ | [2, 4, 6, 8, 10] | ]]></ac:plain-text-body></ac:structured-macro> |