wijjit.tags.display.TreeItemExtension

class wijjit.tags.display.TreeItemExtension(environment)[source]

Jinja2 extension for the {% treeitem %} tag.

Declares a node inside a {% tree %} body. Items may nest to form a hierarchy:

{% tree id="files" show_root=False %}
    {% treeitem label="src" %}
        {% treeitem %}app.py{% endtreeitem %}
        {% treeitem %}cli.py{% endtreeitem %}
    {% endtreeitem %}
    {% treeitem %}README.md{% endtreeitem %}
{% endtree %}

A leaf item uses its body as the label; a parent item (one that contains nested treeitems) should set the label attribute, since its body also contains the child item markers.

Parameters:

environment (Environment)

__init__(environment)
Parameters:

environment (Environment)

Return type:

None

Methods

__init__(environment)

attr(name[, lineno])

Return an attribute node for the current extension.

bind(environment)

Create a copy of this extension bound to another environment.

call_method(name[, args, kwargs, dyn_args, ...])

Call a method of the extension.

filter_stream(stream)

It's passed a TokenStream that can be used to filter tokens returned.

parse(parser)

Parse the treeitem tag.

preprocess(source, name[, filename])

This method is called before the actual lexing and can be used to preprocess the source.

Attributes

identifier

priority

the priority of that extension.

tags

if this extension parses this is the list of tags it's listening to.

tags: t.Set[str] = {'treeitem'}

if this extension parses this is the list of tags it’s listening to.

parse(parser)[source]

Parse the treeitem tag.

Parameters:

parser (jinja2.parser.Parser) – Jinja2 parser

Returns:

Parsed node tree

Return type:

jinja2.nodes.CallBlock

identifier: t.ClassVar[str] = 'wijjit.tags.display.TreeItemExtension'