Comment

Ian Bicking

I wrote something like this some time ago:

http://svn.w4py.org/ZPTKit/trunk/ZPTKit/htmlrender.py

It uses HTMLParser, which is kind of crappy, but BS didn't exist at the time.

Replies

Peter Bengtsson

I seem to be getting excess linebreaks with that but I'm sure there's a solution to that too. Your script doesn't use footnotes but <url/in/angle/brackets> instead. I'll think about that because that's also a respected "email format".

Ian Bicking

I've never noticed excess linebreaks. I realize sometimes I ignore \r, though; it's possible I eliminate meaningless \n and not \r.

We used lynx originally before I wrote this, but people really didn't like the output and of course there's nothing you can do to control it. For actual emailing we'd render the email template twice, once with an text=True and once with text=False, and then you can tweak things in the template however you want (e.g., leave out some navigation from the text version).