Nannou is a templating engine designed for html (but not only) codogeneration of complex objects with arbitrary structure. It based by pattern matching concept and influenced by refal and xslt languages.
Thus nannou forces better decomposition in templates and object model. In return certain complex cases may require additional hacks and decorations.
Data
>>> data = {'foo': [{'bar':1, 'baz':2}, {'bar':None, 'baz':{'foo':'x x x'}}]}
Template
<!--/ foo -->
<div class="foo">
<%foo%>
</div>
<!--/ bar baz -->
<span><|em><%bar%></em|>
<%baz%>
</span>
Compiling
>>> import nannou
>>> f = nannou.compile(tmpl, {})
Running
>>> print f(data)
Produces
<div class="foo">
<span><em>1</em>
2
</span>
<span>
<div class="foo">
x x x
</div>
</span>
</div>
Nannou avaible wia PyPI
http://pypi.python.org/pypi/nannou/
Lastest version can be found in mercurial repository:
https://bitbucket.org/nyufac/nannou/
After downloading go to source folder and type:
make build
This build nannou package. After that you can type
python setup.py install
or
pip install dist/nannou-x.x.x.tar.gz
where x.x.x is current version.