exhibition.filters.jinja2 module¶
Jinja2 template filter
To use, add the following to your configuration file:
filter: exhibition.filters.jinja2
-
class
exhibition.filters.jinja2.
Mark
(environment)[source]¶ Bases:
jinja2.ext.Extension
Marks a section for use later:
{% mark intro %} <p>My Intro</p> {% endmark %} <p>Some more text</p>
This can then be referenced via
Node.marks
.-
identifier
= 'exhibition.filters.jinja2.Mark'¶
-
parse
(parser)[source]¶ If any of the
tags
matched this method is called with the parser as first argument. The token the parser stream is pointing at is the name token that matched. This method has to return one or a list of multiple nodes.
if this extension parses this is the list of tags it’s listening to.
-
-
class
exhibition.filters.jinja2.
RaiseError
(environment)[source]¶ Bases:
jinja2.ext.Extension
Raise an exception during template rendering:
{% raise "This is an error" %}
-
identifier
= 'exhibition.filters.jinja2.RaiseError'¶
-
parse
(parser)[source]¶ If any of the
tags
matched this method is called with the parser as first argument. The token the parser stream is pointing at is the name token that matched. This method has to return one or a list of multiple nodes.
if this extension parses this is the list of tags it’s listening to.
-
-
exhibition.filters.jinja2.
content_filter
(node, content)[source]¶ This is the actual content filter called by
exhibition.main.Node
on appropiate nodes.- Parameters
node – The node being rendered
content – The content of the node, stripped of any YAML frontmatter