Other filters
id
Filter for retrieving a data object's ID.
The filter is 'permissive' and checks for keys and attributes called id
or extId
.
{% if region|id == 'CZ010' %}Městské části{% else %}Okresy{% endif %} v# {{region|name|morph('Case=Loc')}}
- Městské části v Praze.
- Okresy v Plzeňském kraji.
enum
(Cs/En)
Generates an enumeration, for example:
{{['x', 'y', 'z']|enum}}
→ x, y and z (English){{['x', 'y', 'z']|enum}}
→ x, y a z (Czech)
Basic mathematical operations
It is possible to use filters for basic mathematical operations like finding a maximum, minimum or summation (and average from it).
Assuming this data:
{ "prices": [32.19, 32.24, 32.21, 36.33, 33.41, 36.33, 31.77, 31.81 ] }
we can generate the following
(note the ln
filter is used to obtain localized numbers):
The maximal price is {{prices|max|ln}} EUR.
→ The maximal price is 36.33 EURThe minimal price is {{prices|min|ln}} EUR.
→ The minimal price is 31.77 EUR.The average price is {{((prices|sum)/(prices|length))|ln}} EUR.
→ The average price is 33.29 EUR.