diff --git a/engine.py b/engine.py index b13899d..4c949fe 100644 --- a/engine.py +++ b/engine.py @@ -5,14 +5,14 @@ class SuperFormatter(string.Formatter): """World's simplest Template engine.""" def format_field(self, value, spec): - if spec.startswith('repeat'): + if spec.startswith('repeat:'): template = spec.partition(':')[-1] if type(value) is dict: value = value.items() - return ''.join([template.format(item=item) for item in value]) + return ''.join([self.format(template,item=item) for item in value]) elif spec == 'call': return value() - elif spec.startswith('if'): + elif spec.startswith('if:'): return (value and spec.partition(':')[-1]) or '' else: return super(SuperFormatter, self).format_field(value, spec)