NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/58074: .Lk mishandles missing anchor-text
>Number: 58074
>Category: bin
>Synopsis: .Lk mishandles missing anchor-text
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 24 15:20:00 +0000 2024
>Originator: Valery Ushakov
>Release: NetBSD 10
>Organization:
>Environment:
NetBSD snips 10.0_RC3 NetBSD 10.0_RC3 (GENERIC) #0: Wed Jan 17 21:22:02 MSK 2024 uwe@majava:/home/uwe/work/netbsd/cvs/src-release-10/sys/arch/macppc/compile/GENERIC macppc
>Description:
From source code inspection .Lk with a missing anchor-text but with
the trailing punctuation is intended to do the right thing, but
doesn't. E.g. in distrib/notes/common/main
revision 1.574
date: 2024-03-24 16:18:02 +0300; author: martin; state: Exp; lines: +3 -4; commitid: caZuafzIoIV5Mp3F;
Use single-arg "Lk" macro for a link so we can get reasonable results
both in .more and .html output (still a bit odd, but better than before IMHO).
had to drop the trainling dot from what should have been
.Lk https://www.NetBSD.org/ .
b/c the above is currently misformatted as:
For more information please visit .: https://www.NetBSD.org/
instead of
For more information please visit https://www.NetBSD.org/.
>How-To-Repeat:
Use
.Lk http://some/url .
in a mdoc document.
>Fix:
From a quick source code inspection Lk seems to have the intention to
handle the above properly. The Lk macro is defined to
.de Lk
. ds doc-str-Lk Sy \$@
.
. ie (\n[.$] > 1) \{\
. 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 " \$@
. \}
. el \
. doc-get-width "\$1"
. \}
. el \
. doc-get-width "\$1"
i.e. if the second argument is a punctuation (doc-arg-type is 3 or
more), it is not treated as an anchor-text (cf. the top-level else for
the case of just one argument).
The bug seems to be that while the doc-get-arg-type is documented to
expect the width of the argument in `doc-width', Lk doesn't do that
(cf. other uses of these macros elsewhere in doc.tmac). The fix is
probably just:
--- doc.tmac.~1.2.~ 2016-01-13 22:01:59.000000000 +0300
+++ doc.tmac 2024-03-24 18:12:18.401745081 +0300
@@ -6416,6 +6416,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:
which seems to do the right thing for the release notes with
.Lk https://www.NetBSD.org/ .
in distrib/notes/common/main, getting
<a href="https://www.NetBSD.org/">https://www.NetBSD.org/</a>.
and
https://www.NetBSD.org/.
(with the url in bold and dot not in bold).
Home |
Main Index |
Thread Index |
Old Index