|
From: | Larry Kollar |
Subject: | Re: [Groff] Generating HTML / XML |
Date: | Tue, 2 May 2006 09:02:07 -0400 |
Gaius Mulley wrote:
Thanks for the quick reply. W.r.t. your question below, I like making "the www macro set initialise post-grohtml with the correct set of tags forheadings, titles, preformatted text etc." Sounds great to me.ok, I wonder whether it could be improved if say the www.tmac told post-grohtml which tags to use together with a tag priority (similar to operator precedence) - which post-grohtml could then determine if a tag should be nested with the current tag stack or whether the current top of stack tag should be popped.. This modification _might_ allow post-grohtml to be emit trivial XML or any tag based output (well in basic form anyway)
I gave this idea (turning grohtml into a general groxml post- processor) some passing thought a while back, but never really developed it to the point where I felt it worth sharing.
The idea I had was to make tag generation table-driven, similar to what AT&T nroff used for printer drivers (I wrote one for the NEC SpinWriter back when). The default table would still generate HTML, and probably live in the (version).tmac directory. An alternate table (for DocBook, DITA, OpenDoc, or whatever) could be specified with a command-line option, and live anywhere along the GROFF_TMAC_PATH.
In the meantime, unless you have specific needs, grohtml produces HTML that can be cleaned up fairly easily & then transformed to something else. You can add a layer on top of ms/mwww to produce more customized output or add CLASS-based hooks for transformation. Here's an example:
.\" format MIB variables .de MIB .ie '\\*[.T]'html' .HTML \\$3<b class=\"mib\">\\$1</b>\\$2 .el \\$3\f[HB]\s-1\\$1\s0\fP\\$2 ..For character-class formatting like that, a character-level tag (like B) gives you a fallback format if the CSS goes missing or a browser doesn't support it (or the user turned off CSS). Of course, you can use SPAN if you want the fallback to be plain text.
-- Larry Kollar k o l l a r @ a l l t e l . n e t Unix Text Processing: "UTP Revival" http://unixtext.org/
[Prev in Thread] | Current Thread | [Next in Thread] |