Skip to content
Myr

test.py

This file

Path

examples/basic/test.py

29 lines · 675 bytes · Python

Last changed by

Merge remote-tracking branch 'origin/3.0.x'David Lordbefore adoptionf1c51b3

History of this file

Take it

The walk stopped after 200 commits: lines older than 35aa194 point at it.

Update oudated CutomLoader code example (#1185)Xinbin Huangbefore adoption35aa194

lines 1–7why, one step back
1from jinja2 import Environment
2from jinja2.loaders import DictLoader34env = Environment(5 loader=DictLoader(6 {7 "child.html": """\

Merge remote-tracking branch 'origin/3.0.x'David Lordbefore adoptionf1c51b3

line 8why, one step back
8{% extends default_layout or 'default.html' %}

Update oudated CutomLoader code example (#1185)Xinbin Huangbefore adoption35aa194

lines 9–16why, one step back
9{% include helpers = 'helpers.html' %}
10{% macro get_the_answer() %}42{% endmacro %}11{% title = 'Hello World' %}12{% block body %}13 {{ get_the_answer() }}14 {{ helpers.conspirate() }}15{% endblock %}16""",

Merge remote-tracking branch 'origin/3.0.x'David Lordbefore adoptionf1c51b3

line 17why, one step back
17 "default.html": """\

Update oudated CutomLoader code example (#1185)Xinbin Huangbefore adoption35aa194

lines 18–29why, one step back
18<!doctype html>
19<title>{{ title }}</title>20{% block body %}{% endblock %}21""",22 "helpers.html": """\23{% macro conspirate() %}23{% endmacro %}24""",25 }26 )27)28tmpl = env.get_template("child.html")29print(tmpl.render())