Text to HTML algorithm.

Gustavo Cordova gcordova at hebmex.com
Wed Mar 27 16:07:45 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.
> 

Er... that's not quite what I had in mind.

I wish to create printable documentation from SQL scripts.
The SQL parser is done, the structure annotator is done,
it's already creating basic documentation.

What's needed is a way to integrate all the special comments
(which have a "@" as the first non-space char in the text)
into the generated documents.

Using <pre>...</pre> would be quite easy, but then
the quality of the output is greatly decreased.

> > 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.

I'm already generating HTML using a much simpler library,
just to balance tags and indentation.

> 
> Regards,
> Martin
> 

Thanks.

-gustavo




More information about the Python-list mailing list