test.py
This file
Path
examples/basic/test.py
27 lines · 611 bytes · Python
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 2108244 point at it.
Added inheritance tests.Armin Ronacherbefore adoption2108244
lines 1–27why, one step back1from jinja2 import Environment2from jinja2.loaders import DictLoader34env = Environment(loader=DictLoader({5'child.html': u'''\6{% extends master_layout or 'master.html' %}7{% include helpers = 'helpers.html' %}8{% macro get_the_answer() %}42{% endmacro %}9{% title = 'Hello World' %}10{% block body %}11 {{ get_the_answer() }}12 {{ helpers.conspirate() }}13{% endblock %}14''',15'master.html': u'''\16<!doctype html>17<title>{{ title }}</title>18{% block body %}{% endblock %}19''',20'helpers.html': u'''\21{% macro conspirate() %}23{% endmacro %}22'''23}))242526tmpl = env.get_template("child.html")27print tmpl.render()