tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mdocml.bsd.lv
Subject: Re: Groff difference: punctuation following Lk
Date: Sun, 9 Apr 2017 23:22:47 +0200	[thread overview]
Message-ID: <20170409212247.GC76366@athene.usta.de> (raw)
In-Reply-To: <80788.1491038992@cathet.us>

Hi Anthony,

Anthony J. Bentley wrote on Sat, Apr 01, 2017 at 03:29:52AM -0600:

> Consider the following mdoc(7) source:
> 
>     .Lk https://www.example.com/ .
> 
> In mandoc(1), this gets rendered as:
>     https://www.example.com/.
> 
> Doing the same with groff-1.22.3's nroff(1) yields:
> 
>     .: https://www.example.com/

That's an obvious bug in groff.

> It (unexpectedly, to me at least) treats the period as the text of the
> link, rather than punctuation that trails the macro.
> 
> I guess mandoc's behavior is wrong, even though it makes more sense...

I guess not.

How do you like the following patch?

The way the .Lk macro is implemented in groff indicates that mandoc's
behaviour is intendet.  Why would you do an explicit check against
punctuation (the \n[doc-arg-type] < 3) unless you want to handle
punctuation specially?  Given the non-obvious calling conventions
of doc-get-arg-type, it is prone to forgetting the necessary setup
of doc-width, which seems to be what happened here...

By the way, this improves the formatting of sendbug(1), whois(1),
SSL_CTX_get_max_cert_list(3), acx(4), oce(4), and isakmpd.conf(5)
with groff.

If you like it, tell me and i'll submit a patch to the groff
bugtracker and prepare a patch for the OpenBSD ports tree.

Yours,
  Ingo


diff --git a/tmac/doc.tmac-u b/tmac/doc.tmac-u
index 8f9f90fb..71c68466 100644
--- a/tmac/doc.tmac-u
+++ b/tmac/doc.tmac-u
@@ -6454,6 +6454,7 @@
 .  ds doc-str-Lk Sy \$@
 .
 .  ie (\n[.$] > 1) \{\
+.    doc-get-width "\$2"
 .    doc-get-arg-type \$2
 .    ie (\n[doc-arg-type] < 3) \{\
 .      Em \)\$2:
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2017-04-09 21:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01  9:29 Anthony J. Bentley
2017-04-09 21:22 ` Ingo Schwarze [this message]
2017-04-09 21:47   ` Anthony J. Bentley
2017-04-10  0:49     ` Ingo Schwarze
2017-04-11 13:58       ` Ingo Schwarze
2017-04-12  4:17         ` Anthony J. Bentley

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=20170409212247.GC76366@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@mdocml.bsd.lv \
    /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).