Despite the many conveniences of mdoc, I find syntax of troff is still a bit too newline-rich or "spaghetti" compared to the other languages. Consider this example:
.Sh DESCRIPTION
The
.Nm
utility extracts C interface descriptions from a header file composed
using the SQLite documentation syntax (see
.Sx SYNTAX ) .
It then emits the corresponding set of
.Xr mdoc 7
manpages, one per interface description.
By default,
.Nm
reads from standard input and outputs files into the current directory.
Its arguments are as follows:
All these lines for a paragraph starting a list is quite odd to me. Is there a way to call macros inline?
What I have tried involves using the strings syntax to invoke the macros, as groff's manual states that strings, diversions, and macros are stored in a shared namespace. This does get me somewhere, but the .if conditions on at the start of the macros end up not processed and spit out raw.
.Sh DESCRIPTION
The \*[Nm] utility extracts C interface descriptions from a header file composed
using the SQLite documentation syntax (see \*[Sx SYNTAX]).
It then emits the corresponding set of \*[Xr mdoc 7] manpages, one per interface
description. By default, \*[Nm] reads from standard input and outputs files into
the current directory.
Its arguments are as follows:
I then tried to add another string definition to insert a newline. .ds n \! didn't quite work, and what I ended up having was a diversion:
.box n
\!
.box
.Sh DESCRIPTION
The \*n\*[Nm] utility extracts C interface descriptions... (see \*n\*[Sx SYNTAX]).
It then...
Now the .if spam is gone, but unfortunately I get a stray, actual newline in the output. Is there a more perfect way to call these macros? (We will think about mandoc compatibility later.)
Addendum:
- With the "see SYNTAX" bit added, it appears that the newline is somehow inherent to the
.Nmmacro, as the.Sxone only produces a stray trailing space. Still, can we get rid of both? - If I remove the space after
\*n\*[Nm], the extra newline is gone, but that looks... odd in the source. TheSYNTAXone is improved by calling\n*[Sx Syntax ) .]like in the original, but it somehow produces a paragraph break too.