equivalent of nevow.tags.raw for twisted.web.template -
i'm trying port pydoctor twisted.web.template , have hit pretty basic problem: pydoctor uses epydoc render docstrings html can't see way include html in generated page without escaping. can do?
there is, intentionally, no way insert html page without parsing; twisted.web.template
bit more of stickler producing correct output nevow was.
there couple of ways around this.
- ultimately, html going kind of output stream. insert renderer returns pair of
deferred
objects, ,.write
underlying stream after first 1 fires before second. kind of gross, expresses intent :). - you can re-parse output of epydoc html using
xmlstring
or similar,twisted.web.template
can write out correctly. "waste" little bit of cpu, in opinion worth (a) stress-test give t.w.t , (b) guarantee - presumingt.w.t
correct - give you're emitting valid html.
as writing answer, however, realized point 2 isn't possible arbitrary html current public api of twisted.web.template. ideally, use html5lib
parse stuff, , dump parsed input document tree.
if don't mind mucking around private api, hook html5lib's sax support internal sax parser use load templates.
of course, real solution fix ticket filed, don't have use private api outside of twisted itself...
Comments
Post a Comment