Commit 88f604c6 by Pieter van de Bruggen

Fixing errors relating to Windows-style newlines.

parent 9de38680
...@@ -130,12 +130,15 @@ class Template(object): ...@@ -130,12 +130,15 @@ class Template(object):
# Standalone (non-interpolation) tags consume the entire line, # Standalone (non-interpolation) tags consume the entire line,
# both leading whitespace and trailing newline. # both leading whitespace and trailing newline.
tagBeganLine = not tagPos or template[tagPos - 1] == '\n' tagBeganLine = not tagPos or template[tagPos - 1] in ['\r', '\n']
tagEndedLine = (pos == len(template) or template[pos] == '\n') tagEndedLine = (pos == len(template) or template[pos] in ['\r', '\n'])
interpolationTag = captures['tag'] in ['', '&', '{'] interpolationTag = captures['tag'] in ['', '&', '{']
if (tagBeganLine and tagEndedLine and not interpolationTag): if (tagBeganLine and tagEndedLine and not interpolationTag):
pos += 1 if pos < len(template):
pos += template[pos] == '\r' and 1 or 0
if pos < len(template):
pos += template[pos] == '\n' and 1 or 0
elif captures['whitespace']: elif captures['whitespace']:
buffer.append(captures['whitespace']) buffer.append(captures['whitespace'])
tagPos += len(captures['whitespace']) tagPos += len(captures['whitespace'])
......
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