Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

multiline comments not working #33

Closed
fczuardi opened this Issue · 1 comment

2 participants

Fabricio C Zuardi Chris Jerdonek
Fabricio C Zuardi

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:
Chris Jerdonek cjerdonek referenced this issue from a commit
Chris Jerdonek cjerdonek Merge 'issue_33' into development: closing issue #33 (multiline comme…
…nts)

Multiline comments now permitted.  Fix courtesy of fczuardi.
dbf1928
Chris Jerdonek
Collaborator

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

Chris Jerdonek cjerdonek closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.