Martijn Faassen wrote:
The current implementation allows you to start with an HTML file.
That's the "template" class parameter, which is the full path to an
initial (well-formed) document, which is parsed on __init__ into an
ElementTree. If it has "id" attributes in tags, all the better for
hooking-in dynamic content. At the moment, there is a bit of an issue
with namespaces / namespaced elements and attributes, but a file with
standard, non-namespaced HTML will work just fine.
Jim Washington wrote:
Martijn Faassen wrote:
Inspired by Kid (in turn among others inspired by ZPT), the main
template language of TurboGears, written by the people who also
created Trac, and it seems to be getting traction. TurboGears among
others is going to adopt it, but also things like the creator of
SQLAlchemy (and Myghthy) spending time optimizing it, etc. It's
close enough to ZPT to be palatable to me, and has some nice
features for reuse.
If we're going to get out of the server business we could also
consider getting out of the template language business. :)
I'm a big fan of using lxml.etree for templating. Very pythonic,
very easy to refactor, very explicit.
It's premature to announce (we plan to have eggs on pypi soon) , but
take a look at zif.xtemplate at zif.sourceforge.net . It's pretty
alpha at the moment, but it uses a DTD and some xpath to get around
the "tags that shouldn't be minimized" issue, and it includes a first
stab at an HTML sanitizer, to use when snippets of untrusted HTML are
to be included on a page. In addition, the entire page DOM is
available for postprocessing right up until serialization. Of
course, those with better lxml knowledge are encouraged to point out
issues with the implementation.
I just took a brief look at this. Do I understand that this templating
solution basically generates the entire template from Python? There is
no actual textual template present at all, right? I understand you
could add them back and use XPath, the elementtree API and even XSLT
to generate templates, but in the default there is no template?
I have used this approach when I needed to generate very particular
XML, but for web templating I generally expect there to be a textual
template. This way it becomes more easy to take a template created by
a designer and integrate it into ones system. What are your thoughts
Zope3-dev mailing list