4 ms·
The python Nagare framework use both approaches of programmatic HTML and minimalist HTML templating. For example, to create a HTML list, in a div, from a Python
by apoirier 17y ago
The python Nagare framework use both approaches of programmatic HTML
and minimalist HTML templating. For example, to create a HTML list,
in a div, from a Python list:
from nagare.namespaces import xhtml
l = ['the', 'mandatory', 'hello', 'world']
h = xhtml.Renderer()
with h.div(id='content'):
with h.ul:
h << [h.li(element) for element in l]
print h.root.write_htmlstring()
Or a (X)HTML template can have nodes annotated with a 'meld:id=<id>'
attribut. They are then retreived and manipulated in Python.
In both cases, one of the main goal is not to reinvent a new
syntax / templating language but to use normal Python with all its power.
Also the generated (X)HTML is always well-formed.
http://www.nagare.org/trac/wiki/PresentationTier http://www.nagare.org/trac/wiki/PresentationTier