Skip to content

Commit

Permalink
Merge pull request #81 from nineinchnick/formatter-subtemplate
Browse files Browse the repository at this point in the history
allow advanced templates in repeat blocks
  • Loading branch information
izar authored Mar 11, 2020
2 parents fa5ae2a + 812fc6c commit 6c928ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytm/template_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def format_field(self, value, spec):
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'):
return (value and spec.partition(':')[-1]) or ''
else:
return super(SuperFormatter, self).format_field(value, spec)
return super(SuperFormatter, self).format_field(value, spec)

0 comments on commit 6c928ec

Please sign in to comment.