text to html

Grant Edwards invalid at invalid.invalid
Tue Dec 13 13:14:06 EST 2011


On 2011-12-13, Pedro Henrique Guedes Souto <pedro.h.souto at gmail.com> wrote:
> On Tue, Dec 13, 2011 at 3:22 PM, prakash jp <prakash.stack at gmail.com> wrote:
>
>> Want to publish a log file as a web page, is there a parser to retain
>> the format of the text as is and then convert to html. Please provide
>> the relevant pointers
>
>
> Hey, You can use this:?http://txt2tags.org/

I think thats a bit too likely to interpret stuff in the log messages
as formatting directives.

Two options come to mind:

  1. Don't use HTML.  Return the logfile as-is with Content-Type:
     text/plain.  [That way the user can also save it if needed.]

  2. Escape the file contents using cgi.escape() and then stick the 
     escaped contents inside <pre> </pre> tags.  That's not as nice,
     since saving it is no longer a useful option.


-- 
Grant Edwards               grant.b.edwards        Yow! Now KEN and BARBIE
                                  at               are PERMANENTLY ADDICTED to
                              gmail.com            MIND-ALTERING DRUGS ...



More information about the Python-list mailing list