Skip to content
Myr

test.py

This file

Path

examples/basic/test.py

31 lines · 714 bytes · Python

Last changed by

Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7

History of this file

Take it

1from __future__ import print_function23from jinja2 import Environment4from jinja2.loaders import DictLoader56env = Environment(7    loader=DictLoader(8        {9            "child.html": u"""\10{% extends master_layout or 'master.html' %}11{% include helpers = 'helpers.html' %}12{% macro get_the_answer() %}42{% endmacro %}13{% title = 'Hello World' %}14{% block body %}15    {{ get_the_answer() }}16    {{ helpers.conspirate() }}17{% endblock %}18""",19            "master.html": u"""\20<!doctype html>21<title>{{ title }}</title>22{% block body %}{% endblock %}23""",24            "helpers.html": u"""\25{% macro conspirate() %}23{% endmacro %}26""",27        }28    )29)30tmpl = env.get_template("child.html")31print(tmpl.render())