diff options
Diffstat (limited to 'examples/basic/inheritance.py')
-rw-r--r-- | examples/basic/inheritance.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/basic/inheritance.py b/examples/basic/inheritance.py new file mode 100644 index 0000000..6d928df --- /dev/null +++ b/examples/basic/inheritance.py @@ -0,0 +1,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()) |