...
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 verbatim tag allows you to write Pebble syntax that won't be parsed.
Example |
{% verbatim %}
{% if not varA is defined %}
{% set varA = "Abc" %}
{% endif %}
{% endverbatim %}
|
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 %}
{% br lf %}
{% br crlf %}
{% br other "|" %}
|
counter
...
Example |
{% counter %} pencil {% counter %} pens |
Output |
1 pencil 2 pens |
Example 2 |
Template "Other": {% counter local %}
Main template: {% counter local %}{% include "Other" %}
|
Outputs |
11 |
declare
...
Note |
---|
|
The following are the same: {% declare encapsulation = true %}
{% set encapsulation = encapsulation | default(true) %}
|
Example |
{% set varA = "aa" %}
{% declare varA = "bb" %}
{% declare varB = "cc" %}
{{ varA }} {{ varB }}
|
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 %} {% error "Something terrible has occurred" %}
|
indent
...
The from tag is used to iterate a subset of a collection defined by the where condition.
Template |
{% from ${collection} as ${var} where ${test} %}
${content}
{% endfrom %}
|
Example |
{% from range(1,10) as num where num is even %}
{{- num }}{% br %}
{% endfrom %}
|
Output |
2
4
6
8
10
|
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} %}
${content}
{% else %}
${content}
{% endfrom %}
|
Example |
{% from [] as num where num is even -%}
Even numbers{% br %}
{% else -%}
Empty collection{% endfrom %}
|
Output |
Empty collection
|
list add
The list with add tag is used to append a value to a list.
{% set alphabet = <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"] %}
|
]]></ac:plain-text-body></ac:structured-macro>{{ alphabet }}{% br %}
{% list alphabet add "d" -%}
{{ alphabet }}
|
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[]]></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="bfa00ab0-ee96-4a6d-8634-4209365435f9"><ac:plain-text-body><![CDATA[]]></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.
{% set alphabet = <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"] %}
|
]]></ac:plain-text-body></ac:structured-macro>
{{ alphabet }}{% br %}
{% list alphabet add "d", "e", "f" -%}
{{ alphabet }}
|
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[] ]></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f082b706-09a4-48fc-baa0-9d447b4595b4"><ac:plain-text-body><!CDATA[[]]></ac:plain-text-body></ac:structured-macro> list remove
The list with remove tag is used to remove a value from a list.
<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"] %}
|
]]></ac:plain-text-body></ac:structured-macro>{% list alphabet remove "d", "e", "f" -%}
{{ alphabet }}
|
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[] ]></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="faa6e075-80d6-401b-9baf-a7cad9582951"><ac:plain-text-body><!CDATA[[, e, f]]></ac:plain-text-body></ac:structured-macro> | Anchor |
---|
| _list_removes |
---|
| _list_removes |
---|
|
list removes
The list with remove tag is used to remove one or more values from a list.
<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"] %}
|
]]></ac:plain-text-body></ac:structured-macro>
{{ alphabet }}{% br %}
{% list alphabet remove "d", "e", "f" -%}
{{ alphabet }}
|
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[]]></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d21a329f-2180-4035-9b7b-0e6918d1d8ec"><ac:plain-text-body><![CDATA[]]></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} %}
${content}
{% endplacebottom %}
|
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 %}
{{ evenNums }}
|
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>
|