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.

  1. 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 :).
  2. 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 - presuming t.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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -