Fixed a bug that caused syntax errors when defining macros or using the
`{% call %}` tag inside loops.
This fixes #323.
--HG--
branch : trunk
diff --git a/tests/test_forloop.py b/tests/test_forloop.py
index fa1e03b..b7079c8 100644
--- a/tests/test_forloop.py
+++ b/tests/test_forloop.py
@@ -160,3 +160,18 @@
{%- for item in foo recursive -%}{%- endfor -%}
''')
assert t.render(dict(foo=[])) == ''
+
+
+def test_call_in_loop(env):
+ t = env.from_string('''
+ {%- macro do_something() -%}
+ [{{ caller() }}]
+ {%- endmacro %}
+
+ {%- for i in [1, 2, 3] %}
+ {%- call do_something() -%}
+ {{ i }}
+ {%- endcall %}
+ {%- endfor -%}
+ ''')
+ assert t.render() == '[1][2][3]'