From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id ad4879df for ; Tue, 11 Apr 2017 08:58:21 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1cxwJG-0004tH-UY; Tue, 11 Apr 2017 15:58:20 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1cxwJF-00029T-4A; Tue, 11 Apr 2017 15:58:17 +0200 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1cxwJE-0000qc-UR; Tue, 11 Apr 2017 15:58:17 +0200 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id aca56c7a; Tue, 11 Apr 2017 15:58:16 +0200 (CEST) Date: Tue, 11 Apr 2017 15:58:16 +0200 From: Ingo Schwarze To: "Anthony J. Bentley" Cc: tech@mdocml.bsd.lv Subject: Re: Groff difference: punctuation following Lk Message-ID: <20170411135816.GD27284@athene.usta.de> References: <80788.1491038992@cathet.us> <20170409212247.GC76366@athene.usta.de> <65939.1491774443@cathet.us> <20170410004924.GA50206@athene.usta.de> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170410004924.GA50206@athene.usta.de> User-Agent: Mutt/1.6.2 (2016-07-01) 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