Commit 50bdc535 by Pieter van de Bruggen

Handling standalone tags.

parent 03303acc
......@@ -54,9 +54,17 @@ class Template(object):
buffer.append(captures['content'])
pos = match.end()
# Save the whitespace following the text content.
# TODO: Standalone tags should consume this.
# Standalone (non-interpolation) tags consume the entire line,
# both leading whitespace and trailing newline.
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.
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