[TxMt] html pretty print
h.wickham at gmail.com
Thu May 24 06:52:44 UTC 2007
On 5/21/07, Juan Falgueras <jfalgueras at uma.es> wrote:
> I used to need pretty print my C++ code for students and I have found
> the next simple script solves my problem in a cute way, since it
> shows me the formatted code in a separate window (output "Show as
> HTML") and then I can easily copy the source (Cmd-Opt-U) or the
> styled text (copying directly from the output window):
> ----- input "Selected text" or "Document"
> echo "<PRE>"
> enscript --language=html -Ecpp -e -B --color \
> --header="$TM_FILENAME|$E|pag. $% de $=" --title="$TM_FILENAME" \
> -o- 2>/dev/null | \
> perl -ne 'next if (1../<PRE>/i); last if (m|</PRE>|..1); print'
> echo "</PRE>"
> ------ output "Show as HTML"
> --- Save nothing, source.c
> I would like to generalize it for it to be used with other source
> code, not only C, what should be the better way? to have a table
> mapping modes with enscript input modes... ?
> Any help will be welcome.
Have you seen ultraviolet: http://ultraviolet.rubyforge.org/ ? It
does syntax highligting using the textmate language definitions and
More information about the textmate