summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
Diffstat (limited to 'pystache')
-rw-r--r--pystache/renderengine.py4
-rw-r--r--pystache/tests/test_renderengine.py15
2 files changed, 17 insertions, 2 deletions
diff --git a/pystache/renderengine.py b/pystache/renderengine.py
index e1d57e4..bdbb30a 100644
--- a/pystache/renderengine.py
+++ b/pystache/renderengine.py
@@ -208,8 +208,8 @@ class RenderEngine(object):
#
# TODO: should we check the arity?
new_template = element(template)
- parsed_template = self._parse(new_template, delimiters=delims)
- parts.append(parsed_template.render(context))
+ new_parsed_template = self._parse(new_template, delimiters=delims)
+ parts.append(new_parsed_template.render(context))
continue
context.push(element)
diff --git a/pystache/tests/test_renderengine.py b/pystache/tests/test_renderengine.py
index d7f6bf7..b13e246 100644
--- a/pystache/tests/test_renderengine.py
+++ b/pystache/tests/test_renderengine.py
@@ -517,6 +517,21 @@ class RenderTests(unittest.TestCase, AssertStringMixin):
self._assert_render(u'<~bar~#bar#>', template, context)
+ def test_section__lambda__mixed_list(self):
+ """
+ Test a mixed list of lambdas and non-lambdas as a section value.
+
+ This test case is equivalent to a test submitted to the Mustache spec here:
+
+ https://github.com/mustache/spec/pull/47 .
+
+ """
+ template = '<{{#lambdas}}foo{{/lambdas}}>'
+ context = {'foo': 'bar',
+ 'lambdas': [lambda text: "~{{%s}}~" % text, 1]}
+
+ self._assert_render(u'<~bar~foo>', template, context)
+
def test_section__lambda__not_on_context_stack(self):
"""
Check that section lambdas are not pushed onto the context stack.