bugGNU troff - Bugs: bug #59738, mdoc: .Lk suppresses...

 
 

bug #59738: mdoc: .Lk suppresses end-of-sentence recognition

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sun 20 Dec 2020 07:48:34 AM UTC
 
Category:  Macro mdoc Severity:  2 - Minor
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Fri 16 Sep 2022 05:20:44 PM UTC, comment #4: 

commit 354266268b9d96d0d0130c6d1a0677aca4b4ac47
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Thu Sep 15 12:27:45 2022 -0500

    [mdoc]: Fix Savannah #59738.

    * tmac/doc.tmac (Lk): Process further macro arguments more like other
      macros do, calling `doc-print-recursive`.  This permits recognition of
      end-of-sentence punctuation in the argument list.

    Fixes <https://savannah.gnu.org/bugs/?59738>.

commit 054d16243aba8e88501b51e709c6a81ba2cb0ee7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Thu Sep 15 12:17:30 2022 -0500

    [mdoc]: Regression-test Savannah #59738.

    * tmac/tests/doc_Lk-respect-sentence-ending-punctuation.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run test.

    Test fails at this commit.

G. Branden Robinson <gbranden>
Project Administrator
Thu 15 Sep 2022 05:08:15 PM UTC, comment #3: 

I understand this better now, thanks to a slightly improved grasp of this packages Byzantine internals, and have a fix for it.

Also this was not stated in comment #0, but it affects groff 1.22.4.  Possibly earlier versions, but perhaps not, because Ingo considerably rewrote the `Lk` macro definition after groff 1.22.3.

https://git.savannah.gnu.org/cgit/groff.git/commit/?id=e53dff356d43f358133138d2f99eca7b0a7fda32

Here's a reproducer, albeit not a minimal one because I'm working on verifying several aspects of `Lk` macro behavior in an attempt to avoid regressing any of them.

$ cat EXPERIMENTS/Lk.man
.Dd 2022-09-15
.Dt foo 1
.Os
.Sh Name
.Nm foo
.Nd frobnicate a bar
.Pp
Click
.Lk https://www.gnu.org/software/groff/ here .
.
Or
.Lk https://gitlab.com/cjwatson/man-db here
without trailing punctuation.
.
A degenerate use of
.Li \&Lk
doesn't provide any link text.
.
.Lk https://mandoc.bsd.lv/
.
And that's all we have to say about that.
.
Except we want to end a sentence with a literal
.Li \&Lk .
.
And then see if end-of-sentence detection is lost,
affecting inter-sentence space.
.
.
.Pp
We also want to know if
.Li \&Lk
is
.Dq callable .
.
So let's
.Sy "try it" Ns No : Lk https://git.savannah.gnu.org/cgit/groff.git/ \
"on our Git repository" .
.
Here's another sentence.
$ nroff -mdoc EXPERIMENTS/Lk.man | cat -s
mdoc warning: Empty input line #34

Name
     foo — frobnicate a bar

     Click here: https://www.gnu.org/software/groff/. Or here:
     https://gitlab.com/cjwatson/man-db without trailing punctuation.  A de‐
     generate use of Lk doesn't provide any link text.  https://mandoc.bsd.lv/
     And that's all we have to say about that.  Except we want to end a sen‐
     tence with a literal Lk.  And then see if end-of-sentence detection is
     lost, affecting inter-sentence space.

     We also want to know if Lk is “callable”.  So let's try it: on our Git
     repository: https://git.savannah.gnu.org/cgit/groff.git/. Here's another
     sentence.

Here is the patch I have in progress and the output using it.

diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 8838f4c49..bc3d4ca47 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -6755,13 +6755,12 @@
 .  nop \f[\n[doc-curr-font]]\c
 .
 .  \" Format trailing arguments, like punctuation, if any.
-.  \" XXX: This loses track of end-of-sentence state.
-.  while (\n[doc-arg-ptr] <= \n[doc-arg-count]) \{\
-.    nop \&\*[doc-arg\n[doc-arg-ptr]]\c
-.    nr doc-arg-ptr +1
+.  ie (\n[doc-arg-ptr] <= \n[doc-arg-count]) \
+.    doc-print-recursive
+.  el \{\
+.    nop \&
+.    doc-reset-args
 .  \}
-.  nop \&
-.  doc-reset-args
 ..
 .ec
 .
$ ./build/test-groff -Tascii -mdoc -dAD=l -rHY=0 EXPERIMENTS/Lk.man
foo(1)                      General Commands Manual                     foo(1)

Name
     foo -- frobnicate a bar

     Click here: https://www.gnu.org/software/groff/.  Or here:
     https://gitlab.com/cjwatson/man-db without trailing punctuation.  A
     degenerate use of Lk doesn't provide any link text.
     https://mandoc.bsd.lv/ And that's all we have to say about that.  Except
     we want to end a sentence with a literal Lk.  And then see if end-of-
     sentence detection is lost, affecting inter-sentence space.

     We also want to know if Lk is "callable".  So let's try it: on our Git
     repository: https://git.savannah.gnu.org/cgit/groff.git/.  Here's another
     sentence.

GNU                               2022-09-15                            foo(1)

G. Branden Robinson <gbranden>
Project Administrator
Sat 26 Jun 2021 09:55:46 AM UTC, comment #2: 

We don't have a "blocked" status, so using "Postponed" for it.

G. Branden Robinson <gbranden>
Project Administrator
Mon 24 May 2021 02:29:35 AM UTC, comment #1: 

I think this is blocked on bug #60571; it's a general problem when macros usurp the production of sentence endings from the user.

As noted there, we need a language feature to expose and/or manipulate end-of-sentence detection more flexibly.

Leaving this bug open so that mdoc can apply whatever solution is eventually developed in the formatter.

G. Branden Robinson <gbranden>
Project Administrator
Sun 20 Dec 2020 07:48:34 AM UTC, original submission:  

Probably need Ingo's input for this one.

The attached example renders incorrectly in both mandoc(1) and groff -mdoc; trailing punctuation does not undergo end-of-sentence recognition.

The .Lk implementation is a bit complex, but I'm guessing the problem has to do with indiscriminate usage of

.nop \&

after the trailing punctuation.  I may not understand the use of the word "delimiter" in the macro definition--is it for the angle bracket macros (Ao, Ac) or does it refer to the terminating punctuation argument?  If the latter, I don't think it should be called a "delimiter".

G. Branden Robinson <gbranden>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50528:  sample.mdoc added by gbranden (380B - application/octet-stream)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-16 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2022-09-15 gbranden StatusPostponed In Progress
        Assigned toNone gbranden
        Planned ReleaseNone 1.23.0
    2022-08-17 barx Dependencies- Depends on bugs #60571
    2021-06-26 gbranden StatusNone Postponed
    2020-12-20 gbranden Attached File- Added sample.mdoc, #50528

    Back to the top


    Powered by Savane 3.9