multiline comments not working #33

Closed
fczuardi opened this Issue Sep 29, 2011 · 1 comment

Projects

None yet

2 participants

@fczuardi

From: http://mustache.github.com/mustache.5.html

Comments may contain newlines.

Here is my testcase:

import pystache
print pystache.render('foo{{! baz }}bar')
print pystache.render('foo{{! \nbaz }}bar')

Expected output:

foobar
foobar

Current output:

foobar
foo{{! 
baz }}bar

Sugested fix:

--- a/pystache/template.py
+++ b/pystache/template.py
@@ -66,7 +66,7 @@ class Template(object):
         self.section_re = re.compile(section % tags, re.M|re.S)

         tag = r"%(otag)s(#|=|&|!|>|\{)?(.+?)\1?%(ctag)s+"
-        self.tag_re = re.compile(tag % tags)
+        self.tag_re = re.compile(tag % tags,re.DOTALL)

     def _render_sections(self, template, view):
         while True:
@cjerdonek cjerdonek added a commit that referenced this issue Dec 22, 2011
@cjerdonek cjerdonek Merge 'issue_33' into development: closing issue #33 (multiline comme…
…nts)

Multiline comments now permitted.  Fix courtesy of fczuardi.
dbf1928
@cjerdonek
Collaborator

@fczuardi, thanks for the report, test case, and fix!

@cjerdonek cjerdonek closed this Dec 22, 2011
@mihais mihais pushed a commit to android-ia/platform_external_pystache that referenced this issue May 7, 2015
@cjerdonek cjerdonek Fixed issue #33 (via fczuardi): "multiline comments not working" 41b1581
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment