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: Tue, 11 Apr 2017 15:58:16 +0200	[thread overview]
Message-ID: <20170411135816.GD27284@athene.usta.de> (raw)
In-Reply-To: <20170410004924.GA50206@athene.usta.de>

Hi Anthony,

Ingo Schwarze wrote on Mon, Apr 10, 2017 at 02:49:24AM +0200:
> Anthony J. Bentley wrote on Sun, Apr 09, 2017 at 03:47:23PM -0600:

>> I like it very much.

> Good, thanks for having a look, submitted to groff.

Today, it was committed to groff.
Carsten Kunze is doing good work over there.

>> Groff's output still differs in two ways that I can see.

> Yes, i'm aware of these two differences, but followed the
> concept of "one change at a time".

So, here is the next proposed change, considerably more intrusive
than the first.

>> The first is that it doesn't handle multiple arguments well:
>> 
>> .Lk https://www.example.com/ a b c
>> 
>> becomes "a: https://www.example.com/ b c" in groff (b and c bolded),
>> instead of "a b c: https://example.com/" in mandoc.

> I agree that the mandoc behaviour is useful and the groff behaviour
> is useless, confusing, and likely unintentional.  I'll probably
> look whether groff can be improved.  I can't believe anybody relies
> on the current behaviour.

The following patch does the following:

 * Use the second and following arguments as the link text.
 * Do not mark up the following colon with \fI.
 * Handle any number of trailing delimiters.

What do you think?
If you like it, i'll propose it for groff.

Yours,
  Ingo


diff --git a/tmac/doc.tmac-u b/tmac/doc.tmac-u
index 71c68466..eab0b95f 100644
--- a/tmac/doc.tmac-u
+++ b/tmac/doc.tmac-u
@@ -6447,37 +6447,53 @@
 .\" NS   link (for conversion to HTML)
 .\" NS
 .\" NS local variables:
+.\" NS   doc-delim-Lk
 .\" NS   doc-reg-Lk
-.\" NS   doc-str-Lk
+.\" NS   doc-target-Lk
+.\" NS   doc-text-Lk
 .
 .de Lk
-.  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:
-.      ds doc-str-Lk Sy "\$1"
-.      doc-get-width "\$1"
-.      shift 2
-.      if \n[.$] \
-.        as doc-str-Lk " \$@
+.  \" The first argument is the target URI.
+.  ds doc-target-Lk \$1
+.  shift
+.
+.  \" Split the remaining arguments into link text and delimiters.
+.  ds doc-text-Lk
+.  ds doc-delim-Lk
+.  while \n[.$] \{\
+.    doc-get-width "\$1"
+.    doc-get-arg-type \$1
+.    ie (\n[doc-arg-type] > 2) \
+.      as doc-delim-Lk \$1
+.    el \{\
+.      if !'\*[doc-delim-Lk]'' \{\
+.        \" More text follows delimiter(s); go back to text mode.
+.        as doc-text-Lk \*[doc-delim-Lk]
+.        ds doc-delim-Lk
+.      \}
+.      ie '\*[doc-text-Lk]'' \
+.        ds doc-text-Lk \$1
+.      el \
+.        as doc-text-Lk " \$1
 .    \}
-.    el \
-.      doc-get-width "\$1"
+.    shift
 .  \}
-.  el \
-.    doc-get-width "\$1"
 .
+.  \" Print the link text, if any.
+.  if !'\*[doc-text-Lk]'' \
+.      Em \*[doc-text-Lk] Ns :
+.
+.  \" Print link target.
 .  ie n \
 .    nr doc-reg-Lk 26
 .  el \
 .    nr doc-reg-Lk 38
+.  doc-get-width "\*[doc-target-Lk]"
 .  ie (\n[doc-width] >= \n[doc-reg-Lk]) \
-.    D1 \*[doc-str-Lk]
-.  el \
-.    \*[doc-str-Lk]
+.    D1 Sy \*[doc-target-Lk] Ns \*[doc-delim-Lk]\&
+.  el .ie \n[doc-width] \
+.    Sy \*[doc-target-Lk] Ns \*[doc-delim-Lk]\&
+.  el \*[doc-delim-Lk]\&
 ..
 .
 .


P.S.
This is still open, but a separate issue:

> Yes, doc.tmac-u hardcodes a limit for inserting a virtual .D1 macro
> of >= 26\(en for nroff, but 38 for troff.  That is weird, but the
> end-result usually looks OK, ...
 
>> Mandoc doesn't indent in either case.

>  ... so probably mandoc should follow.
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2017-04-11 13:58 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
2017-04-09 21:47   ` Anthony J. Bentley
2017-04-10  0:49     ` Ingo Schwarze
2017-04-11 13:58       ` Ingo Schwarze [this message]
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=20170411135816.GD27284@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).