Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 165acbcc075de8309bb2fd18f8fd0952 > files > 97

python2-jinja2-2.11.3-1.mga7.noarch.rpm

from __future__ import print_function

from jinja2 import Environment

tmpl = Environment().from_string(
    """\
<ul>
{%- for item in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] if item % 2 == 0 %}
    <li>{{ loop.index }} / {{ loop.length }}: {{ item }}</li>
{%- endfor %}
</ul>
if condition: {{ 1 if foo else 0 }}
"""
)
print(tmpl.render(foo=True))