discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: Ingo Schwarze <schwarze@usta.de>
Cc: Jan Stary <hans@stare.cz>, discuss@mandoc.bsd.lv
Subject: Re: No-arg .Nm (also .Bx?) breaks .Bd -literal?
Date: Mon, 6 Jun 2022 17:39:11 +0200	[thread overview]
Message-ID: <20220606153911.w4bvcz6zqsjde7so@tarta.nabijaczleweli.xyz> (raw)
In-Reply-To: <Yp3anPorF9Xbb4uc@asta-kit.de>

[-- Attachment #1: Type: text/plain, Size: 5781 bytes --]

Hi!

On Mon, Jun 06, 2022 at 12:44:44PM +0200, Ingo Schwarze wrote:
> That's even more surprising; .Bx is never a block macro, so maybe
> there is another bug or the bug has a different reason after all.

Encouraged by your simple diagnosis, I had a minor go:

Given:
-- >8 --
.Sh NAME
.Nm tr
.Nd trupsko
.Sh DESCRIPTION
.Bd -literal
.Nm
.Ed
.Sh DESCRIPTION2
.Bd -literal
.Nm tr2
.Ed
.Sh DESCRIPTION3
.Bd -literal
.Bx
.Ed
.Sh DESCRIPTION3
.Bd -literal
trupsko
.Ed
-- >8 --

-Ttree gives
-- >8 --
title = "UNTITLED"
name  = "tr"
vol   = "LOCAL"
os    = ""
date  = ""

Sh (block) *1:2
  Sh (head) 1:2 ID=HREF
      NAME (text) 1:5
  Sh (body) 1:2
      Nm (elem) *2:2
          tr (text) 2:5
      Nd (block) *3:2
        Nd (head) 3:2
        Nd (body) 3:2
            trupsko (text) 3:5
Sh (block) *4:2
  Sh (head) 4:2 ID=HREF
      DESCRIPTION (text) 4:5
  Sh (body) 4:2
      Bd (block) -literal *5:2
        Bd (head) 5:2
        Bd (body) 5:2
            Nm (elem) *6:2 NOFILL
                tr (text) 6:2 NOSRC
Sh (block) *8:2
  Sh (head) 8:2 ID=HREF
      DESCRIPTION2 (text) 8:5
  Sh (body) 8:2
      Bd (block) -literal *9:2
        Bd (head) 9:2
        Bd (body) 9:2
            Nm (elem) *10:2 NOFILL
                tr2 (text) 10:5 NOFILL
Sh (block) *12:2
  Sh (head) 12:2 ID=HREF
      DESCRIPTION3 (text) 12:5
  Sh (body) 12:2
      Bd (block) -literal *13:2
        Bd (head) 13:2
        Bd (body) 13:2
            Bx (elem) *14:2 NOFILL
                BSD (text) 14:2 NOSRC
Sh (block) *16:2
  Sh (head) 16:2 ID=HREF
      DESCRIPTION3 (text) 16:5
  Sh (body) 16:2
      Bd (block) -literal *17:2
        Bd (head) 17:2
        Bd (body) 17:2
            trupsko (text) *18:1 NOFILL
-- >8 --

But -Ttree -Onoval gives:
-- >8 --
Sh (block) *1:2
  Sh (head) 1:2
      NAME (text) 1:5
  Sh (body) 1:2
      Nm (elem) *2:2
          tr (text) 2:5
      Nd (block) *3:2
        Nd (head) 3:2
        Nd (body) 3:2
            trupsko (text) 3:5
Sh (block) *4:2
  Sh (head) 4:2
      DESCRIPTION (text) 4:5
  Sh (body) 4:2
      Bd (block) -literal *5:2
        Bd (head) 5:2
        Bd (body) 5:2
            Nm (elem) *6:2 NOFILL
Sh (block) *8:2
  Sh (head) 8:2
      DESCRIPTION2 (text) 8:5
  Sh (body) 8:2
      Bd (block) -literal *9:2
        Bd (head) 9:2
        Bd (body) 9:2
            Nm (elem) *10:2 NOFILL
                tr2 (text) 10:5 NOFILL
Sh (block) *12:2
  Sh (head) 12:2
      DESCRIPTION3 (text) 12:5
  Sh (body) 12:2
      Bd (block) -literal *13:2
        Bd (head) 13:2
        Bd (body) 13:2
            Bx (elem) *14:2 NOFILL
Sh (block) *16:2
  Sh (head) 16:2
      DESCRIPTION3 (text) 16:5
  Sh (body) 16:2
      Bd (block) -literal *17:2
        Bd (head) 17:2
        Bd (body) 17:2
            trupsko (text) *18:1 NOFILL
-- >8 --

For a diff of
-- >8 --
diff --git a/tr b/nova
index aa4b73c..b177b2e 100644
--- a/tr
+++ b/nova
@@ -1,5 +0,0 @@
-title = "UNTITLED"
-name  = "tr"
-vol   = "LOCAL"
-os    = ""
-date  = ""
@@ -8 +3 @@ Sh (block) *1:2
-  Sh (head) 1:2 ID=HREF
+  Sh (head) 1:2
@@ -18 +13 @@ Sh (block) *4:2
-  Sh (head) 4:2 ID=HREF
+  Sh (head) 4:2
@@ -25 +19,0 @@ Sh (block) *4:2
-                tr (text) 6:2 NOSRC
@@ -27 +21 @@ Sh (block) *8:2
-  Sh (head) 8:2 ID=HREF
+  Sh (head) 8:2
@@ -36 +30 @@ Sh (block) *12:2
-  Sh (head) 12:2 ID=HREF
+  Sh (head) 12:2
@@ -43 +36,0 @@ Sh (block) *12:2
-                BSD (text) 14:2 NOSRC
@@ -45 +38 @@ Sh (block) *16:2
-  Sh (head) 16:2 ID=HREF
+  Sh (head) 16:2
-- >8 --

Note how the text injected by the validator is NOSRC while the "raw"
text, and the text in .Nm tr2 is NOFILL.

I (naively) replaced all NODE_NOSRC with NODE_NOSRC | NODE_NOFILL in
mdoc_validate.c (none of them had it previously), to great success!

-Ttree now yielded:
-- >8 --
title = "UNTITLED"
name  = "tr"
vol   = "LOCAL"
os    = ""
date  = ""

Sh (block) *1:2
  Sh (head) 1:2 ID=HREF
      NAME (text) 1:5
  Sh (body) 1:2
      Nm (elem) *2:2
          tr (text) 2:5
      Nd (block) *3:2
        Nd (head) 3:2
        Nd (body) 3:2
            trupsko (text) 3:5
Sh (block) *4:2
  Sh (head) 4:2 ID=HREF
      DESCRIPTION (text) 4:5
  Sh (body) 4:2
      Bd (block) -literal *5:2
        Bd (head) 5:2
        Bd (body) 5:2
            Nm (elem) *6:2 NOFILL
                tr (text) 6:2 NOFILL NOSRC
Sh (block) *8:2
  Sh (head) 8:2 ID=HREF
      DESCRIPTION2 (text) 8:5
  Sh (body) 8:2
      Bd (block) -literal *9:2
        Bd (head) 9:2
        Bd (body) 9:2
            Nm (elem) *10:2 NOFILL
                tr2 (text) 10:5 NOFILL
Sh (block) *12:2
  Sh (head) 12:2 ID=HREF
      DESCRIPTION3 (text) 12:5
  Sh (body) 12:2
      Bd (block) -literal *13:2
        Bd (head) 13:2
        Bd (body) 13:2
            Bx (elem) *14:2 NOFILL
                BSD (text) 14:2 NOFILL NOSRC
Sh (block) *16:2
  Sh (head) 16:2 ID=HREF
      DESCRIPTION3 (text) 16:5
  Sh (body) 16:2
      Bd (block) -literal *17:2
        Bd (head) 17:2
        Bd (body) 17:2
            trupsko (text) *18:1 NOFILL
-- >8 --

And the .Bd -literals in -Thtml were all fixed, too!
-- >8 --
<div class="Bd Li">
<pre><code class="Nm">tr</code></pre>
</div>
<div class="Bd Li">
<pre><code class="Nm">tr2</code></pre>
</div>
<div class="Bd Li">
<pre><span class="Ux">BSD</span></pre>
</div>
<div class="Bd Li">
<pre>trupsko</pre>
</div>
-- >8 --

There are a lot of elements that generate NOSRC text and I don't know
which of them genuinely shouldn't have NOFILL (and there's some
conditional ones like you said), but as PoC I think this narrows the
problem down.

Best,
наб

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-06-06 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-05 16:30 наб
     [not found] ` <Ypz026hcl/USRzsr@www.stare.cz>
2022-06-05 18:54   ` наб
2022-06-06 10:44     ` Ingo Schwarze
2022-06-06 15:39       ` наб [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220606153911.w4bvcz6zqsjde7so@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=discuss@mandoc.bsd.lv \
    --cc=hans@stare.cz \
    --cc=schwarze@usta.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).