HTML to Text renderer

Ian Bicking ianb at colorstudy.com
Wed Nov 3 00:36:43 EST 2004


Robert Brewer wrote:
> Ian Bicking wrote:
> 
>>Does anyone know of a module that can render HTML to text?  Just a 
>>subset of HTML, really; I'd like to compose emails using <p> tags and 
>>whatnot, fill in all the values in the email template, then 
>>apply word 
>>wrapping and other formatting.  Also, it'll make using Zope Page 
>>Templates with email easier.
>>
>>Even if all it supports is <p> and <br> that would be enough, but I'm 
>>hoping there's something even more complete out there.  I don't need 
>>something as general as, say, Lynx; these templates would be written 
>>with a specific renderer in mind.
> 
> 
> To clarify: you don't want the HTML tags merely stripped; you want to
> replace e.g. br with a line break and p with, say, two line breaks?

Right.  And word wrapping too.  Some other tags would also be 
interesting: <blockquote>, <pre>, <hr>, <table>,  , and something 
to control alignment (e.g., <p align="">).

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org



More information about the Python-list mailing list