Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

html prettifier/beautifier for tcl

279 views
Skip to first unread message

Tcl Bliss

unread,
Oct 19, 2010, 3:40:01 PM10/19/10
to
Does anyone know of a good html prettifier/beautifier for tcl source
code, similar to http://code.google.com/p/google-code-prettify/ ?
Perhaps one can be created for the above Google project?

Arndt Roger Schneider

unread,
Oct 19, 2010, 5:42:13 PM10/19/10
to
Tcl Bliss schrieb:

> Does anyone know of a good html prettifier/beautifier for tcl source
> code, similar to http://code.google.com/p/google-code-prettify/ ?
> Perhaps one can be created for the above Google project?

Try Vim html export.
-roger

Tcl Bliss

unread,
Oct 19, 2010, 7:38:13 PM10/19/10
to
On Oct 19, 2:42 pm, Arndt Roger Schneider <arndt.ro...@addcom.de>
wrote:

Actually, what I am looking for command that does it inline, real
time, something that can be used in a script or inside a web page. TCL
package would be the best, or Javascript.

I thought of doing it myself but haven't figured out how to do it yet.
I would guess that it needs to work pretty much the way TCL parser
works, which is something I still need to learn.

Harald Oehlmann

unread,
Oct 20, 2010, 2:47:48 AM10/20/10
to
On 20 Okt., 01:38, Tcl Bliss <tcl.bl...@gmail.com> wrote:
> On Oct 19, 2:42 pm, Arndt Roger Schneider <arndt.ro...@addcom.de>
> wrote:
> > Tcl Bliss schrieb:
> > > Does anyone know of a good html prettifier/beautifier for tcl source
> > > code, similar tohttp://code.google.com/p/google-code-prettify/?
> > > Perhaps one can be created for the above Google project?

> Actually, what I am looking for command that does it inline, real


> time, something that can be used in a script or inside a web page. TCL
> package would be the best, or Javascript.

As I understood your initial post, you want to pretty-print TCL Code
and have output in HTML ?

- JavaScript Module: the Google prettifier you mentioned gives
instructions how to extent this for other languages, might be easy for
TCL...

- TCL Module: Jos Decoster has extended the TCL wiki by a TCL code
beautifier with HTML output.
The code must be available somewhere. If you have issues, contact Jos.

Harald

Arndt Roger Schneider

unread,
Oct 20, 2010, 4:07:02 AM10/20/10
to
Tcl Bliss schrieb:

The DocBook toolchain contains syntax highlighting for
Tcl: search for xslthl; as the name suggests it works
as a XSL-transformation coupled with sax.
Xslthl uses a two-pass transformation: first the relevant
codeblocks are instrumented with xslthl identifiers,
like xslthl:string, and second the xslthl identifiers are
replaced by html/css code.

For code samples see my Jeszra website:
http://jeszra/sourceforge,net/jeszra

-roger

Glenn Jackman

unread,
Oct 20, 2010, 10:07:10 AM10/20/10
to
At 2010-10-19 07:38PM, "Tcl Bliss" wrote:
> On Oct 19, 2:42�pm, Arndt Roger Schneider <arndt.ro...@addcom.de> wrote:
> > Tcl Bliss schrieb:
> >
> > > Does anyone know of a good html prettifier/beautifier for tcl source
> > > code, similar tohttp://code.google.com/p/google-code-prettify/?
> > > Perhaps one can be created for the above Google project?
> >
> > Try Vim html export.
>
> Actually, what I am looking for command that does it inline, real
> time, something that can be used in a script or inside a web page. TCL
> package would be the best, or Javascript.

This Tcl command

exec vim -c "runtime syntax/html.vim" -c w -c qa file.tcl

creates file.tcl.html

--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous

Glenn Jackman

unread,
Oct 20, 2010, 10:15:27 AM10/20/10
to
At 2010-10-19 07:38PM, "Tcl Bliss" wrote:
> On Oct 19, 2:42�pm, Arndt Roger Schneider <arndt.ro...@addcom.de> wrote:
> > Tcl Bliss schrieb:
> >
> > > Does anyone know of a good html prettifier/beautifier for tcl source
> > > code, similar tohttp://code.google.com/p/google-code-prettify/?
> > > Perhaps one can be created for the above Google project?
> >
> > Try Vim html export.
>
> Actually, what I am looking for command that does it inline, real
> time, something that can be used in a script or inside a web page. TCL
> package would be the best, or Javascript.

This Tcl command


exec vim -c "runtime syntax/html.vim" -c w -c qa file.tcl
creates file.tcl.html

I have an alias in myh .bashrc
alias beautify_tcl='frink -egINnz -w 150'
Can't remember the last time I used it though. http://wiki.tcl.tk/2611

phil

unread,
Oct 20, 2010, 10:40:55 AM10/20/10
to

Its not pretty in the sense of color coding...

but the tdom package will read in a messy html file without newlines,
and spit back out a prettier version.

package require tdom
...
set x [dom parse -html $a]
puts [$x asXML]

tomk

unread,
Oct 20, 2010, 1:06:19 PM10/20/10
to

FYI, I believe the Tcl'er Wiki uses an extended version of the google-
code-prettify code to prettify tcl code.

Tom K.

Tcl Bliss

unread,
Oct 21, 2010, 12:30:09 PM10/21/10
to
Thanks everyone for the links/tips. I will pick one that works the
best or use one as an example to code my own. Looking at examples I
noticed that there isn't much intelligence involved (the way TCL
parser works), you just get a list of keywords/operands/functions/
variables, regexp for each and add highlighting code. I expected it to
be more complicated than that.

Johannes Kuhn

unread,
Oct 21, 2010, 3:46:06 PM10/21/10
to
http://nagelfar.berlios.de/ can do this. (use the html output option)
0 new messages