A small templating language
This implements a small templating language. This language implements if/elif/else, for/continue/break, expressions, and blocks of Python code. The syntax is:
{{any expression (function calls etc)}} {{any expression | filter}} {{for x in y}}...{{endfor}} {{if x}}x{{elif y}}y{{else}}z{{endif}} {{py:x=1}} {{py: def foo(bar): return 'baz' }} {{default var = default_value}} {{# comment}}
You use this with the Template class or the sub shortcut. The Template class takes the template string and the name of the template (for errors) and a default namespace. Then (like string.Template) you can call the tmpl.substitute(**kw) method to make a substitution (or tmpl.substitute(a_dict)).
sub(content, **kw) substitutes the template immediately. You can use __name='tmpl.html' to set the name of the template.
If there are syntax errors TemplateError will be raised.