fune/third_party/python/Jinja2/examples/basic/cycle.py
Chris H-C 329ab8a4a5 Bug 1635260 - Update vendored glean_parser to 1.28.0 r=janerik
Using ./mach vendor python glean_parser==1.28.0

(this is the latest version)

Differential Revision: https://phabricator.services.mozilla.com/D84746
2020-07-29 16:53:10 +00:00

18 lines
340 B
Python

from __future__ import print_function
from jinja2 import Environment
env = Environment(
line_statement_prefix="#", variable_start_string="${", variable_end_string="}"
)
print(
env.from_string(
"""\
<ul>
# for item in range(10)
<li class="${loop.cycle('odd', 'even')}">${item}</li>
# endfor
</ul>\
"""
).render()
)