jinja_env
This object is a configured Jinja2 environment. For more information you can refer to the Jinja 2 Documentation.
This is where plugins can inject additional data like custom filters, tests or global functions.
from lektor.pluginsystem import Plugin class MyPlugin(Plugin): ... def on_setup_env(self, **extra): def shout_filter(value): return unicode(value).upper() + '!!!!1111' self.env.jinja_env.filters['shout'] = shout_filter
Then you can use this filter from templates:
<h1>{{ page.title|shout }}</h1>
Comments