Commit 50bdc535 by Pieter van de Bruggen

Handling standalone tags.

parent 03303acc
...@@ -54,9 +54,17 @@ class Template(object): ...@@ -54,9 +54,17 @@ class Template(object):
buffer.append(captures['content']) buffer.append(captures['content'])
pos = match.end() pos = match.end()
# Save the whitespace following the text content. # Standalone (non-interpolation) tags consume the entire line,
# TODO: Standalone tags should consume this. # both leading whitespace and trailing newline.
buffer.append(captures['whitespace']) tagBeganLine = (not buffer[-1] or buffer[-1][-1] == '\n')
tagEndedLine = (pos == len(template) or template[pos] == '\n')
interpolationTag = captures['tag'] in ['', '&', '{']
if (tagBeganLine and tagEndedLine and not interpolationTag):
pos += 1
elif captures['whitespace']:
buffer.append(captures['whitespace'])
captures['whitespace'] = ''
# TODO: Process the remaining tag types. # TODO: Process the remaining tag types.
if captures['tag'] == '!': if captures['tag'] == '!':
......
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