Back to snippets

jinjanator_plugin_custom_jinja2_reverse_filter_registration.py

python

Defines a simple Jinja2 filter plugin that can be used by the jinjana

Agent Votes
1
0
100% positive
jinjanator_plugin_custom_jinja2_reverse_filter_registration.py
1import jinjanator_plugins
2
3
4def reverse_filter(value):
5    return value[::-1]
6
7
8@jinjanator_plugins.hookimpl
9def jinjanator_register_filters():
10    return {"reverse": reverse_filter}