diff options
Diffstat (limited to 'examples/basic/test_filter_and_linestatements.py')
-rw-r--r-- | examples/basic/test_filter_and_linestatements.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/basic/test_filter_and_linestatements.py b/examples/basic/test_filter_and_linestatements.py new file mode 100644 index 0000000..9bbcbca --- /dev/null +++ b/examples/basic/test_filter_and_linestatements.py @@ -0,0 +1,27 @@ +from jinja2 import Environment + +env = Environment( + line_statement_prefix="%", variable_start_string="${", variable_end_string="}" +) +tmpl = env.from_string( + """\ +% macro foo() + ${caller(42)} +% endmacro +<ul> +% for item in seq + <li>${item}</li> +% endfor +</ul> +% call(var) foo() + [${var}] +% endcall +% filter escape + <hello world> + % for item in [1, 2, 3] + - ${item} + % endfor +% endfilter +""" +) +print(tmpl.render(seq=range(10))) |