<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>flexable</name>
<shortdesc>Template engine with simple data structure</shortdesc>
<description>`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.

&gt;&gt;&gt; t = Template()
&gt;&gt;&gt; t.fromstring("&lt;div/&gt;")
&gt;&gt;&gt; str(t)
'&lt;div/&gt;'

&gt;&gt;&gt; t.merge('hello')
&gt;&gt;&gt; str(t)
'&lt;div&gt;hello&lt;/div&gt;'

&gt;&gt;&gt; t = Template()
&gt;&gt;&gt; t.fromstring("&lt;div&gt;&lt;span class='y'/&gt;&lt;/div&gt;")
&gt;&gt;&gt; t.merge({'y':['1', '2']})
&gt;&gt;&gt; str(t)
'&lt;div&gt;&lt;span class="y"&gt;1&lt;/span&gt;&lt;span class="y"&gt;2&lt;/span&gt;&lt;/div&gt;'

&gt;&gt;&gt; t = Template()
&gt;&gt;&gt; t.fromstring("&lt;div&gt;&lt;span class='y'/&gt;&lt;/div&gt;")
&gt;&gt;&gt; t.merge({'y':[({'@id':'m1'}, '1'), 
...               ({'@id':'m2'}, '2')]})
&gt;&gt;&gt; str(t)
'&lt;div&gt;&lt;span class="y" id="m1"&gt;1&lt;/span&gt;&lt;span class="y" id="m2"&gt;2&lt;/span&gt;&lt;/div&gt;'

&gt;&gt;&gt; t.fromstring("&lt;div&gt;&lt;div class='box'&gt;&lt;span class='x'/&gt;&lt;span
class='y'/&gt;&lt;/div&gt;&lt;/div&gt;")
&gt;&gt;&gt; t.merge({'box':[{'x':'1', 'y':'2'},
...                 {'x':'3', 'y':'4'}]})
&gt;&gt;&gt; str(t)
'&lt;div&gt;&lt;div class="box"&gt;&lt;span class="x"&gt;1&lt;/span&gt;&lt;span
class="y"&gt;2&lt;/span&gt;&lt;/div&gt;&lt;div class="box"&gt;&lt;span class="x"&gt;3&lt;/span&gt;&lt;span
class="y"&gt;4&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;'

&gt;&gt;&gt; t.fromstring("&lt;div/&gt;")
&gt;&gt;&gt; t.merge(ET.Element('span'))
&gt;&gt;&gt; str(t)
'&lt;div&gt;&lt;span/&gt;&lt;/div&gt;'

To use flexable as template engine for wsgi application, you can use
flexable.plugin:FlexablePlugin.
And that is python.template_engine entry point.

Example on TurboGears

controllers.py::

     @expose(template="flexable:flexable_example.templates.example")
    def example(self):
        return dict(message="This is flexable message.",
                    contents=""" This is main contents from controller.
flexable is merge values to given html template with class attribute.
""")

flexable_example/templates/example.html::

 &amp;lt;?xml version="1.0"?&gt;
 &amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &amp;lt;body&gt;
    &amp;lt;h1&gt;Flexable Template&amp;lt;/h1&gt;
    &amp;lt;span class="message"&gt;&amp;lt;/span&gt;
    &amp;lt;p class="contents"&gt;&amp;lt;/p&gt;
    &amp;lt;span class="widget"/&gt;
  &amp;lt;/body&gt;
 &amp;lt;/html&gt;

you get:

 &amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &amp;lt;body&gt;
    &amp;lt;h1&gt;Flexable Template&amp;lt;/h1&gt;
    &amp;lt;span class="message"&gt;This is flexable message.&amp;lt;/span&gt;
    &amp;lt;p class="contents"&gt; This is main contents from controller.
 flexable is merge values to given html template with class attribute.
 &amp;lt;/p&gt;
  &amp;lt;/body&gt;
 &amp;lt;/html&gt;</description>
<maintainer><foaf:Person><foaf:name>Atsushi Odagiri</foaf:name>
<foaf:mbox_sha1sum>672f68b789a8a7409503061a516d16fb67b22656</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.3dev</revision></Version></release>
</Project></rdf:RDF>