Jinja filters¶
In addition to the built-in Jinja filters Atfinity defines more useful filters you can use in your templates:
| Name | Description |
|---|---|
value_or_nothing |
Returns an empty string if the value is None. |
is_known |
Returns True if the value is not None (i.e. known). |
is_unknown |
Returns True if the value is None (i.e. unknown). |
format_date |
Formats a date with the given format string, e.g. {{p.date_of_birth \| format_date('DD/MM/YYYY')}}. Uses the document language. |
format_date_speaking |
Formats a date in a human-readable format (D. MMMM YYYY). Uses the document language. |
format_date_time |
Formats a datetime with optional date_format and time_format arguments. Uses the document language. |
format_date_time_speaking |
Formats a datetime in a human-readable format. Uses the document language. |
yyyymmdd |
Converts a date to the yyyyMMdd string format. |
yes_or_nothing |
Returns "Yes" for True, empty string otherwise. |
yes_or_no |
Returns "Yes" for True, "No" for False. |
skip_digits |
Removes all digits from a string. |
extract_digits |
Returns only the digits from a string. |
format_map |
Formats a string using named placeholders, e.g. {{template_string \| format_map(name='Thorben')}}. Missing placeholders are left as-is. |
deep_get |
Retrieves a nested value from a dictionary using a dot-separated key path, e.g. {{data \| deep_get('address.city')}}. Returns None if any key is missing. |
to_ascii |
Converts a Unicode string to ASCII by removing accents and transliterating ligatures (e.g. ü → u, ß → ss). |