G. Branden Robinson <[email protected]> wrote:
> ... we
> don't have any idea what groff 2.x syntax will look like.
>
> Consider the possibility that, with AT&T parenthesis syntax now just
> about dead, with all System V/DWB-descended troffs that don't support
> GNU troff extension syntax either having a narrow focus (Plan 9) or
> moribund (all others), we might toss the `\n(xx` behind the `-C`
> compatibility mode gate.
>
> And then the foregoing would not work.
Hmm. That at least would lead more people to exercise compatibility
mode. I’ve never been fond of the \X(xx syntax (where X is f, n, *, or
null for named glyphs), and plan to eradicate it from the UTP source
(on the list after the current passive smashing and the subsequent
Great Renaming).
Something like (NOT TESTED):
sed -i.bak -e ’s/\\(f|n|\*)\((..)/\\$1[$2]/g’ \
-e ’s/\\\((..)/\\[$1]/g' *.t
(The latter would fix named glyphs like \(em; in both cases, it would
leave one-character names like \fP or \~ alone.)
> I have few clear ideas for what I'd want to do with a "groff 2" syntax,
> but that sort of thing would be high on my list.
Yes, normalizing the syntax would be a good start. Was it BWK who
described the *roff syntax as “rebarbative”? Something a *little*
closer to XML, without all the XML baggage.
Syntax highlighting for displays, as supported by Markdown and
some other text-based markup systems, would be pretty cool. Maybe
that could be worked into a macro package[1], or…
Interoperability with other processors would be a cool feature, because
users could toss existing chunks of Markdown, XML, or whatever into
groff without having to recode[2]. Rather than trying to throw the kitchen
sink of parsing code into groff, though, let it call other well-known
processors like xsltproc for XML and Pandoc for nearly everything else
(with environment variables, of course, for users who want to use another
processor or fiddle with command-line options). I suppose it would be
possible to do this now[3], using -U and the .sy call… at least for displays.
Something I’d like to see *before* 2.0 is the ability to incorporate both
bitmap graphics and OpenType fonts without all the current hoop-
jumping. I know the latter is possible in Plan9+derivatives, and I think
at least one or two support the former. Getting the H&J up to neatroff’s
level is another pre-2.0 wish.
Larry
[1] If there’s any way to pipe the output of a diversion into a syntax
highlighting module, that could work as well. Since displays use
diversions by default, that’s the first part of the puzzle.
[2] Personally, I don’t think it’s worth the effort to get reasonable
(X)HTML directly out of groff. OTOH, it should be feasible to write a set
of overlay macros to transform, say, nroff -ms input into Markdown,
and then let any of the myriad Markdown processors do the rest. I
might take a stab at that when I get tired of passive-stomping. For
example:
.de I
.nop *$1* $2
..
(Inlines are going to be more difficult.)
[3] The newer versions of Pandoc support output to groff -ms, and
support a “template” to build a cover page and other niceties for what
it calls a “standalone” document. I plan to cover some of this in UTP
Revisited.