Commit 9eab209c by Chris Jerdonek

Fixed issue #33 (via fczuardi): "multiline comments not working"

  See https://github.com/defunkt/pystache/issues/33
parent f6f24cbf
......@@ -106,7 +106,8 @@ class RenderEngine(object):
self.section_re = re.compile(section, re.M|re.S)
tag = r"%(otag)s(#|=|&|!|>|\{)?(.+?)\1?%(ctag)s+" % tags
self.tag_re = re.compile(tag)
# We use re.DOTALL to permit multiline comments, in accordance with the spec.
self.tag_re = re.compile(tag, re.DOTALL)
def _render_tags(self, template):
output = []
......
......@@ -166,3 +166,11 @@ class RenderEngineTestCase(unittest.TestCase):
context = {'test': (lambda text: '{{hi}} %s' % text)}
self._assert_render('{{hi}} Mom', template, context)
def test_render__section__comment__multiline(self):
"""
Check that multiline comments are permitted.
"""
self._assert_render('foobar', 'foo{{! baz }}bar')
self._assert_render('foobar', 'foo{{! \nbaz }}bar')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment