Commit 3e453f82 by Jake Archibald

Chewing through template rather than recursively replacing

parent 9923bef5
...@@ -103,6 +103,8 @@ class Template(object): ...@@ -103,6 +103,8 @@ class Template(object):
return template return template
def _render_tags(self, template): def _render_tags(self, template):
output = ''
while True: while True:
match = self.tag_re.search(template) match = self.tag_re.search(template)
if match is None: if match is None:
...@@ -112,9 +114,11 @@ class Template(object): ...@@ -112,9 +114,11 @@ class Template(object):
tag_name = tag_name.strip() tag_name = tag_name.strip()
func = self.modifiers[tag_type] func = self.modifiers[tag_type]
replacement = func(self, tag_name) replacement = func(self, tag_name)
template = template.replace(tag, replacement) output = output + template[0:match.start()] + replacement
template = template[match.end():]
return template output = output + template
return output
def _render_dictionary(self, template, context): def _render_dictionary(self, template, context):
self.view.context_list.insert(0, context) self.view.context_list.insert(0, context)
......
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