[TxMt] Re: Export selected text to HTML?
Chris Ruzin
cruzin at gmail.com
Sat Feb 5 23:43:07 UTC 2005
Allan Odgaard wrote:
> On Feb 5, 2005, at 20:46, Xavier Noria wrote:
>
>> Just for the record, there are some utilities out there that can help:
>> GNU Source-highlight
>> http://www.gnu.org/software/src-highlite/
>
> Since the OP wanted line numbers, I also did a small awk script to
> insert these, only tested with C++ output though:
> expand -3 | source-highlight -scpp -fhtml \
> | awk '
>
> /^<pre><tt>/ {
> sub("<pre><tt>", "<pre><tt> 1: ");
> print $0; next;
> }
>
> /^<\/tt><\/pre>/ {
> print $0; next;
> }
>
> { printf("%3d: %s\n", ++line + 1, $0); }
> '
I can get the source-highlight to work perfectly. I changed the output to
xhtml (you know, standards and all) and it looks great! However...
whenever I try to pipe it through awk, I just get a single blank line as
output. I copied and pasted your example above. Any ideas as to why it
would do that? I know NOTHING about awk.
Also, is there a way to include the compiled source-highlight files inside
of the TextMate application bundle in the future so this could be a
built-in feature? And one other thing. ("No more!", they cry.) Right
now, you have to staticly type in what the source is. Can TM have a
current file extension variable (or something like that) so we can make
this a single command that will work with any files source-highlight
supports? So the line would instead be something like:
expand -3 | source-highlight -s$TM_EXT -fxhtml
Chris
More information about the textmate
mailing list