D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
usr
/
share
/
doc
/
python2-jinja2
/
examples
/
basic
/
Filename :
test.py
back
Copy
from jinja2 import Environment from jinja2.loaders import DictLoader env = Environment(loader=DictLoader({ 'child.html': u'''\ {% extends master_layout or 'master.html' %} {% include helpers = 'helpers.html' %} {% macro get_the_answer() %}42{% endmacro %} {% title = 'Hello World' %} {% block body %} {{ get_the_answer() }} {{ helpers.conspirate() }} {% endblock %} ''', 'master.html': u'''\ <!doctype html> <title>{{ title }}</title> {% block body %}{% endblock %} ''', 'helpers.html': u'''\ {% macro conspirate() %}23{% endmacro %} ''' })) tmpl = env.get_template("child.html") print(tmpl.render())
Name
Size
Last Modified
Owner
Permissions
Actions
templates
Dir
May 29 2024 3:43:04
root
0755
cycle.py
0.271
KB
January 06 2017 3:24:25
root
0644
debugger.py
0.218
KB
January 06 2017 3:24:25
root
0644
inheritance.py
0.333
KB
January 06 2017 3:24:25
root
0644
test.py
0.598
KB
January 06 2017 3:24:25
root
0644
test_filter_and_linestatements.py
0.436
KB
January 06 2017 3:24:25
root
0644
test_loop_filter.py
0.289
KB
January 06 2017 3:24:25
root
0644
translate.py
0.512
KB
January 06 2017 3:24:25
root
0644
2017 © D7net | D704T team