SILENT KILLERPanel

Current Path: > > opt > alt > python37 > share > doc > alt-python37-jinja2 > examples > basic


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt/python37/share/doc/alt-python37-jinja2/examples/basic

NameTypeSizeLast ModifiedActions
templates Directory - -
cycle.py File 301 bytes April 05 2021 17:47:37.
debugger.py File 223 bytes April 05 2021 17:47:37.
inheritance.py File 392 bytes April 05 2021 17:47:37.
test.py File 675 bytes May 11 2021 23:25:55.
test_filter_and_linestatements.py File 456 bytes April 05 2021 17:47:37.
test_loop_filter.py File 301 bytes April 05 2021 17:47:37.
translate.py File 544 bytes April 05 2021 17:47:37.

Reading File: //opt/alt/python37/share/doc/alt-python37-jinja2/examples/basic/test.py

from jinja2 import Environment
from jinja2.loaders import DictLoader

env = Environment(
    loader=DictLoader(
        {
            "child.html": """\
{% extends default_layout or 'default.html' %}
{% include helpers = 'helpers.html' %}
{% macro get_the_answer() %}42{% endmacro %}
{% title = 'Hello World' %}
{% block body %}
    {{ get_the_answer() }}
    {{ helpers.conspirate() }}
{% endblock %}
""",
            "default.html": """\
<!doctype html>
<title>{{ title }}</title>
{% block body %}{% endblock %}
""",
            "helpers.html": """\
{% macro conspirate() %}23{% endmacro %}
""",
        }
    )
)
tmpl = env.get_template("child.html")
print(tmpl.render())

SILENT KILLER Tool