[Twisted-Python] Woven-generated html needs newlines and whitespace

screwtape at froup.com screwtape at froup.com
Sat Jun 7 03:32:28 EDT 2003


On Sat, Jun 07, 2003 at 11:42:33AM +1000, Adrian van den Dries wrote:
> quoth screwtape at froup.com:
> 
> > In a perfect world, I'd have block HTML elements on their own lines,
> > and inline HTML elements, well, inline. But since Woven spits out XML
> > rather than HTML, that'd be quite hacky to implement. :)
> 
> Why would it be hacky?  HTML is naturally semantic, so it would be
> appropriate for twisted.web.woven.widgets to have a registry of
> elements and their default block display properties.  Woven could then
> have an option to "pretty-format" the output according to the display
> properties.

I think it would be hacky because Woven spits out XML, not HTML. One
thing I tried the other day (as noted on this list) is using Woven to
spit out WML for my mobile phone, instead of HTML for my browser. WML
doesn't (as far as I know) have even the concept of block-vs-inline
elements. 

An XSLT engine I worked with once had several 'output modes' which
changed how it spat out data - if you set it to XML mode, it would
work as you expect. If you set it to text mode, I think it refused to
do XML-style entity references and escaping. And if you set it to HTML
mode, it would 'tidy up' some tags ("<hr/>" -> "<hr>", etc), and
pretty-print.

That's all very nice and useful, but I expect it would be a reasonable
amount of work - work that will only ever become less important as
time wears on and XHTML becomes more common. It's not a sufficiently
crucial feature for me to look into creating.

-- 
 ___________ ____________________________
| Screwtape | Reply-To: munged on Usenet |________ ______ ____ __ _  _   _
|
| "Think of me as CVS with a brain and some taste" -- Linus Torvalds.
|




More information about the Twisted-Python mailing list