Commit a301b62e by Chris Jerdonek

Merge pull request #45 (2) "Chewing through template rather than recursively replacing"

From: https://github.com/jakearchibald/pystache/commit/3e453f8207ba62dec63b106f381340001b11e74a
Into: issue_44
parents 702239d1 3e453f82
......@@ -169,6 +169,8 @@ class Template(object):
return template
def _render_tags(self, template):
output = ''
while True:
match = self.tag_re.search(template)
if match is None:
......@@ -178,9 +180,11 @@ class Template(object):
tag_name = tag_name.strip()
func = self.modifiers[tag_type]
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):
self.context.push(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