groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rc3: groff man pages truncated by mandoc(1)


From: G. Branden Robinson
Subject: Re: rc3: groff man pages truncated by mandoc(1)
Date: Tue, 21 Feb 2023 11:42:50 -0600

At 2023-02-21T22:58:35+1100, John Gardner wrote:
> > If I could do something like the following:
> >
> > .if \n[.mandoc] .als MR IR
> >
> 
> To determine if mandoc(1) is being used to format the current page,
> use
> 
> .if \n(.f=0

John, THANK YOU!  YOU HAVE SAVED MY BACON!

> This is what Mono.tmac
> <https://github.com/Alhadis/Mono/blob/25765171fbf676b623a4bcbf3d9f93384ef83040/ono.tmac#L6>
> uses to identify mandoc(1), and it works quite well: no full Troff
> implementation will mount a font at a position of zero,

...by default, yes.  groff at least will happily let you stick them
there...

$ groff
.fp 0 HR
.ft 0
.tm font=\n[.fn]
font=HR

...but negative font positions are not allowed.

$ ./build/test-groff
.fp -1 HR
troff:<standard input>:1: error: negative font position

However, this is close enough.  I think it will prove a practical
heuristic for mandoc detection.  No man page should be mucking about
with the font mounting positions, or even referring to them: doing so is
not portable.[1]

> and mandoc(1) has absolutely no concept of mounting fonts, period.

Right.

Here is the new MR fallback code (to be inlined into every groff man
page), and it works just fine with mandoc(1) (1.14.5), groff 1.22.4, and
groff Git HEAD.

It also doesn't try to be nearly as clever as my implementation of 3
February (defining a macro within a macro--I should have known better: I
am not Tadziu Hoffman).

.\" 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
.if !\n(.g           .nr do-fallback 1 \" non-groff *roff
.if \n[do-fallback]  \{\
.  de MR
.    ie \\n(.$=1 \
.      I \%\\$1
.    el \
.      IR \%\\$1 (\\$2)\\$3
.  .
.\}
.rr do-fallback

So, after being cross with Ingo for resisting my revolutionary
initiatives, I would just as much like to thank him (and Kristaps
Dzonsons) for implementing _enough_ *roff in mandoc(1) to make the above
possible.

mandoc -Tlint doesn't even screech about it!  (It does about other
things in the page.[2])

Thank you again, John--that bit of insight is a _huge_ help.

Hyrum's Law wins again!

Regards,
Branden

[1] I mean this in an even stronger sense than "is a groffism"--which it
    isn't.  Even back in 1980s "ditroff" days, the default font mounting
    positions were determined by the DESC file, which were user- [well,
    administrator-]modifiable.  If your site had a house preference for
    Helvetica over Times, for example, and had dutifully paid your font
    licensing fees, why _wouldn't_ you update the DESC files
    accordingly?

[2] mandoc -Tlint output:

mandoc: build/tmac/groff_man_style.7:33:2: UNSUPP: unsupported roff request: do
mandoc: build/tmac/groff_man_style.7:3646:3: WARNING: unknown font, skipping 
request: TS fCB lfCB.
mandoc: build/tmac/groff_man_style.7:3646:8: WARNING: unknown font, skipping 
request: TS fCB.
mandoc: build/tmac/groff_man_style.7:3694:3: WARNING: unknown font, skipping 
request: TS fCB lfCB.
mandoc: build/tmac/groff_man_style.7:3694:8: WARNING: unknown font, skipping 
request: TS fCB.
mandoc: build/tmac/groff_man_style.7:3886:3: WARNING: unknown font, skipping 
request: TS fCB lfCB.
mandoc: build/tmac/groff_man_style.7:3886:8: WARNING: unknown font, skipping 
request: TS fCB.
mandoc: build/tmac/groff_man_style.7:3941:3: WARNING: unknown font, skipping 
request: TS fCB LfCB.
mandoc: build/tmac/groff_man_style.7:3941:8: WARNING: unknown font, skipping 
request: TS fCB.
mandoc: build/tmac/groff_man_style.7:4105:2: UNSUPP: unsupported roff request: 
do
mandoc: build/tmac/groff_man_style.7:3:5: STYLE: lower case character in 
document title: TH groff_man_style
mandoc: build/tmac/groff_man_style.7:3:23: WARNING: cannot parse date, using it 
verbatim: 21 February 2023
mandoc: build/tmac/groff_man_style.7:2086:2: WARNING: skipping paragraph macro: 
br at the end of SS

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]