summaryrefslogtreecommitdiffstats
path: root/examples/basic/inheritance.py
blob: 6d928df9e9510b417153000155aa821436ad891e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from jinja2 import Environment
from jinja2.loaders import DictLoader

env = Environment(
    loader=DictLoader(
        {
            "a": "[A[{% block body %}{% endblock %}]]",
            "b": "{% extends 'a' %}{% block body %}[B]{% endblock %}",
            "c": "{% extends 'b' %}{% block body %}###{{ super() }}###{% endblock %}",
        }
    )
)
print(env.get_template("c").render())