[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Tabular html output.
From: |
Heinz-Jürgen Oertel |
Subject: |
Re: [Groff] Tabular html output. |
Date: |
Sun, 23 May 2004 14:22:58 +0200 |
User-agent: |
KMail/1.6.2 |
Am Freitag, 21. Mai 2004 19:58 schrieb Larry Kollar:
>
> Sure. I just shook out a serious bug, so here's a copy that works with
> the attached test file. :-) Use a pipe like this to build HTML:
>
> awk -f htbl.awk test.ms | groff -Thtml -ms >test.html
>
> I hope this inspires some hacking among awk and other experts here....
Hello Larry, thanks, I think this is a good starting point, besides awk is a
strange language. These days I would prefer using Tcl, but anyway, these are
only personal preferences.
I got simple tables working.
We often are using '#' as a table separator. Here the script the fist time
did something wrong with interpreting the line
tab(#);
in your code, the line:
sub( /tab *\(([^)]*)\)/, "\1", ts ); # get parameter for tab
should extract the separator. It didn't with my example.
That leads to the question which awk are you using ?
from the gawk Manual (http://www.gnu.org/software/gawk/manual/):
---------
gensub provides an additional feature
that is not available in sub or gsub:
the ability to specify components of a regexp
in the replacement text.
This is done by using parentheses in the regexp
to mark the components
and then specifying \N in the replacement text,
where N is a digit from 1 to 9.
--------------
So I had to change this line to:
ts = gensub(/.*tab *\((.*)\).*/, "\\1", 1, $0)
Now it works fine.
Question to the list. Is this discussion, improving Larry's script, OT?
Regards
Heinz
- [Groff] Tabular html output., Bruno Hertz, 2004/05/20
- Re: [Groff] Tabular html output., Larry Kollar, 2004/05/21
- Re: [Groff] Tabular html output., Heinz-Jürgen Oertel, 2004/05/21
- Re: [Groff] Tabular html output., Larry Kollar, 2004/05/21
- Re: [Groff] Tabular html output.,
Heinz-Jürgen Oertel <=
- Re: [Groff] Tabular html output., Larry Kollar, 2004/05/23