Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17156 > unrolled thread

Re: text to html

Started byPedro Henrique Guedes Souto <pedro.h.souto@gmail.com>
First post2011-12-13 15:30 -0200
Last post2011-12-14 05:54 -0800
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: text to html Pedro Henrique Guedes Souto <pedro.h.souto@gmail.com> - 2011-12-13 15:30 -0200
    Re: text to html Grant Edwards <invalid@invalid.invalid> - 2011-12-13 18:14 +0000
    Re: text to html James Mills <prologic@shortcircuit.net.au> - 2011-12-14 05:54 -0800

#17156 — Re: text to html

FromPedro Henrique Guedes Souto <pedro.h.souto@gmail.com>
Date2011-12-13 15:30 -0200
SubjectRe: text to html
Message-ID<mailman.3609.1323797442.27778.python-list@python.org>
On Tue, Dec 13, 2011 at 3:22 PM, prakash jp <prakash.stack@gmail.com> wrote:
>
> Hi All,
>
> 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/

Att;
Pedro Henrique Guedes Souto
[pedro.h.souto@gmail.com]

[toc] | [next] | [standalone]


#17158

FromGrant Edwards <invalid@invalid.invalid>
Date2011-12-13 18:14 +0000
Message-ID<jc84ld$59k$1@reader1.panix.com>
In reply to#17156
On 2011-12-13, Pedro Henrique Guedes Souto <pedro.h.souto@gmail.com> wrote:
> On Tue, Dec 13, 2011 at 3:22 PM, prakash jp <prakash.stack@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 ...

[toc] | [prev] | [next] | [standalone]


#17217

FromJames Mills <prologic@shortcircuit.net.au>
Date2011-12-14 05:54 -0800
Message-ID<53d45c20-26f7-475d-99a6-adf3a206470b@s10g2000prs.googlegroups.com>
In reply to#17156
On Dec 14, 3:30 am, Pedro Henrique Guedes Souto
<pedro.h.so...@gmail.com> wrote:
> On Tue, Dec 13, 2011 at 3:22 PM, prakash jp <prakash.st...@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 Pedro,

You could also use pygments
to nicely format the logfile
perhaps even with Syntax Highlighting.

https://bitbucket.org/freecodeteam/hpaste/src/749c36d184a6/hpaste.circuits/paste.py

You could also provide an "Download" link
that services the file up as Content-Type: text/plain

cheers
James

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web