[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [groff] 06/23: [man pages]: Define page-local `MR` fallback.
From: |
Ingo Schwarze |
Subject: |
Re: [groff] 06/23: [man pages]: Define page-local `MR` fallback. |
Date: |
Fri, 24 Feb 2023 09:56:29 +0100 |
Hi Branden,
sorry for being totally swamped right now and temporarily losing
track of mandoc and groff stuff, but by some strange chance, this
caught my eye:
> +.\" Define fallback for groff 1.23's MR macro if the system lacks it.
> +.nr do-fallback 0
> +.if !\n(.f .nr do-fallback 1 \" mandoc
> +.if \n(.g .if !d MR .nr do-fallback 1 \" older groff
This is excessively complicated. Mandoc has been supporting d and !d
for a very long time:
schwarze@isnote $ mandoc -Tascii
"if !d" works:
.if !d MR yes
.if d MR no
() ()
"if !d" works: yes
Besides, in general, using \n(.g is always an extremely bad idea.
Capabilities of implementations (both groff and others) change
over time, so never test for application names or version numbers,
but always test for features.
For example, mandoc supports vast swaths of groff features,
and yet:
schwarze@isnote $ mandoc -Tascii
.ie \(.g groff
.el not groff
() ()
not groff
> +.if !\n(.g .nr do-fallback 1 \" non-groff *roff
What exactly is this aiming for?
schwarze@isnote $ /usr/local/heirloom-doctools/bin/nroff
"if !d" works:
.if !d MR yes
.if d MR no
"if !d" works: yes
Looks like Heirloom does not need it.
schwarze@isnote $ /usr/local/heirloom-doctools/bin/nroff
.if !\n(.g .nr do-fallback 1 \" non-groff *roff
.if \n[do-fallback] doing fallback
.if !\n[do-fallback] not doing fallback
do-fallback] not doing fallback
Looks like Heirloom blows up quite loudly with your
new "compatibility" code.
schwarze@isnote $ /usr/local/plan9/bin/nroff
"if !d" works:
.if !d MR yes
.if d MR no
"if !d" works:
Admittedly, Plan 9 supports neither d nor !d.
But your "compatibility" code does not work either:
schwarze@isnote $ /usr/local/plan9/bin/nroff
.if !\n(.g .nr do-fallback 1 \" non-groff *roff
.if \n[do-fallback] doing fallback
.if !\n[do-fallback] not doing fallback
do-fallback] not doing fallback
I did warn you that .MR might land you in trouble...
I would have prefered being wrong, but here we are. :-(
Yours,
Ingo
- Re: [groff] 06/23: [man pages]: Define page-local `MR` fallback.,
Ingo Schwarze <=