groff
[Top][All Lists]
Advanced

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

Re: [mdoc]: Emit diagnostic if .Mt given no arguments.


From: G. Branden Robinson
Subject: Re: [mdoc]: Emit diagnostic if .Mt given no arguments.
Date: Tue, 22 Dec 2020 15:49:16 +1100
User-agent: NeoMutt/20180716

Hi Ingo!

At 2020-12-20T16:38:05+0100, Ingo Schwarze wrote:
> G. Branden Robinson wrote on Sun, Dec 20, 2020 at 03:38:56AM -0500:
> >     * tmac/doc.tmac-u (Mt): Emit a usage diagnostic and return if
> >       called with no arguments.  This introduces an incompatiblility
> >       with mandoc(1),
> 
> That's not a serious problem, mandoc(1) is easy to adjust in this case
> after the behaviour of groff is improved.

Cool.

> >       mandoc(1) prints a _non_-italicized tilde in this scenario.
> 
> You are mistaken, mandoc(1) is fully compatible with groff(1) in this
> respect.  The output is byte-by-byte identical, and in fact mandoc(1)
> was made bug-compatible with groff(1) in this respect, on purpose:

Yup; you're right.  I forgot to run the output of mandoc through ul(1).

>    $ echo .Mt | mandoc -mdoc | hexdump -C
>   [...]
>   00000050  5f 08 7e 0a 0a 0a        |_.~...|
> 
> That _is_ underscore - backspace - tilde, i.e., an italicized tilde,
> exactly like in groff.

In one of the discussions around this, I had thought someone on this
list had established that the overstriking approach itself has unclear
semantics in some cases, which weakens its claim upon the crown as the
One True Way to represent such things.  But I have forgotten the
details.  A finite state diagram would have been helpful.  If I can find
the observation again, maybe I'll make one.  :)

> I do not object to your general ideas of requiring an argument
> nor of emitting a warning if the argument is missing.
> Maybe even your decision of not printing anything if the argument
> is missing is acceptable.
> 
> But unfortunately, your implementation is incorrect.
> The following still prints the tilde:
> 
>   .Mt .
> 
> The reason is that many mdoc(7) macros implement generic handling for
> trailing punctuation, which you apparently failed to consider.

I certainly did fail to consider it.  There is much magic inside mdoc
that I don't comprehend.  I implemented the easiest thing that seemed to
be correct for inputs that would resemble valid email addresses, and did
not attempt to find degenerate cases like the above.

> So even the multiple-argument macro
> 
>   .Mt . , : ; ) ] ? ! ) \. ) ) \*(Ba ) )
> 
> still needs to be regarded as empty.  Implementing that correctly
> is no doubt possible.  On first sight, i'm not sure how difficult
> that might be and whether it's worth doing.

Well, if you just gave me a complete set of all trailing punctuation
strings, I think I can imagine a way to do it.

> Either way, i don't think your commit can remain as it is.

Do you agree that it's a strict improvement over the status quo ante,
which was to print the italic tilde in the case of 0 arguments?

I am happy to continue to work on this and I appreciate your feedback,
as mdoc is large and my understanding of it fragmentary.  I feel
fortunate that I was able to implement the CT and CS registers without
causing you alarm.  :)

...or had you not reviewed that change yet[1]?  :-O

Regards,
Branden

[1] https://lists.gnu.org/archive/html/groff-commit/2020-10/msg00143.html

Attachment: signature.asc
Description: PGP signature


reply via email to

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