Text to HTML algorithm.
Martin v. Loewis
martin at v.loewis.de
Wed Mar 27 15:03:14 EST 2002
Gustavo Cordova <gcordova at hebmex.com> writes:
> Does anybody have an implementation, or know of one,
> to format plain text into HTML?
Sure. If it does not contain markup,
print "<html><body><pre>%s</pre></body></html>" % plaintext
will fulfill this requirement.
> I need to preserve a minimum of structure, such as
> wrapping <p>...</p> around paragraphs separated by
> at least one empty line and detecting unnumbered
> lists (at least).
If you think you need a pre-existing library, you may want to try
HTMLGen. It knows much about HTML, but little about plain text.
Regards,
Martin
More information about the Python-list
mailing list