Log in or register to vote.

flexable

Template engine with simple data structure

`flexable` is template engine with simple data structure.
That is made up of str, unicode, dict, tuple, list and Element.

usage
merge structured values to xhtml template.

>>> t = Template()
>>> t.fromstring("

")
>>> str(t)
'
'

>>> t.merge('hello')
>>> str(t)
'

hello
'

>>> t = Template()
>>> t.fromstring("

")
>>> t.merge({'y':['1', '2']})
>>> str(t)
'
12
'

>>> t = Template()
>>> t.fromstring("

")
>>> t.merge({'y':[({'@id':'m1'}, '1'),
... ({'@id':'m2'}, '2')]})
>>> str(t)
'
12
'

>>> t.fromstring("

class='y'/>
")
>>> t.merge({'box':[{'x':'1', 'y':'2'},
... {'x':'3', 'y':'4'}]})
>>> str(t)
'
1class="y">2
3class="y">4
'

>>> t.fromstring("

")
>>> t.merge(ET.Element ...

0