diff options
Diffstat (limited to 'third_party/python/Jinja2/examples/basic/inheritance.py')
-rw-r--r-- | third_party/python/Jinja2/examples/basic/inheritance.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/python/Jinja2/examples/basic/inheritance.py b/third_party/python/Jinja2/examples/basic/inheritance.py new file mode 100644 index 0000000000..4a881bf8a8 --- /dev/null +++ b/third_party/python/Jinja2/examples/basic/inheritance.py @@ -0,0 +1,15 @@ +from __future__ import print_function + +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()) |