Hi Branden, Lennart, Doug, On 2023-08-18 01:44, G. Branden Robinson wrote:
> In other words, you want to see what a *roff document looks like after > all macro expansions have been (recursively) performed. Exactly. Basically, I want an equivalent of cpp(1) for expanding man(7) macros. > > I wanted this, too, back in 2017 when I first started working on groff. > > The short answer is "no". > > The longer answer is that this is hard because GNU troff, like AT&T > troff, never builds a complete syntax tree for the document the way > "modern" document formatters do. This gives me some hope. If it's just that both AT&T troff and GNU groff have been designed so that they do two things, but can't do one thing and do it well, then my solution involves writing a manpp(1) from scratch. If you tell me that's possible, and possibly the easiest way, then I may do it some day. Doug, I'm curious about why the original design of man(7) and troff(1)/nroff(1) didn't separate this into a macro preprocessor. Do you remember some details about that? Was it impossible, or maybe too much work? [...] > > I'll say it before Ingo does: mandoc(1) (as I understand it) _does_ > build a syntax tree for the entire document before producing output, > which enables some of the nice features that it has. > > I see Lennart has replied with some further exploration of the > challenges here. Rather than duplicate his comments, let me move on to > something vaguely related but, I hope, potentially useful. Cheers, Alex -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
OpenPGP_signature
Description: OpenPGP digital signature