[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 12/14: [man]: Refactor diversion management (7/7).
|
From: |
G. Branden Robinson |
|
Subject: |
[groff] 12/14: [man]: Refactor diversion management (7/7). |
|
Date: |
Mon, 29 Jan 2024 21:13:49 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 5b012cdcd6da0c2bc4c5ff7964bcd6164029d48e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jan 29 17:13:32 2024 -0600
[man]: Refactor diversion management (7/7).
* tmac/an.tmac (TH): Initialize `an*is-in-link-text-diversion` register.
(an*begin-hyperlink): Set `an*is-in-link-text-diversion` register.
Use the register for its intended purpose. If a nested diversion is
attempted, clear `an*do-hyperlink` register.
(an*end-hyperlink): Clear `an*is-in-link-text-diversion` register
rather than deleting it.
---
ChangeLog | 6 ++++++
tmac/an.tmac | 11 ++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2a812a9ad..34fe60759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,12 @@
(TP): Throw warning if macro is nested with itself or `TQ`.
(an*begin-hyperlink): Throw warning if hyperlink already inside
diversion.
+ (TH): Initialize `an*is-in-link-text-diversion` register.
+ (an*begin-hyperlink): Set `an*is-in-link-text-diversion`
+ register. Use the register for its intended purpose. If a
+ nested diversion is attempted, clear `an*do-hyperlink` register.
+ (an*end-hyperlink): Clear `an*is-in-link-text-diversion`
+ register rather than deleting it.
2024-01-28 G. Branden Robinson <g.branden.robinson@gmail.com>
diff --git a/tmac/an.tmac b/tmac/an.tmac
index f4bc1fcc3..dceed923b 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -300,6 +300,7 @@
. nr an-need-break 0
. nr an*is-in-paragraph-tag-diversion 0
. nr an*is-in-example 0
+. nr an*is-in-link-text-diversion 0
.
. ds an*topic "\\$1\"
. if \\n[CT] .stringup an*topic
@@ -1121,13 +1122,14 @@ contains unsupported escape sequence
. \" We can only hyperlink if we're not in a diversion.
. \" XXX: There's no fundamental reason for that, just a simple matter
. \" of macro programming.
-. nr an*is-in-link-text-diversion 0
. if !'\\n[.z]'' \{\
. an-warn cannot nest .MT or .UR inside .TP; ending paragraph tag
-. nr an*is-in-link-text-diversion 1
+. nr an*do-hyperlink 0
. \}
-. if (\\n[an*is-in-link-text-diversion] & \\n[an*do-hyperlink]) \{\
+. if \\n[an*do-hyperlink] \{\
+. nr an*is-in-link-text-diversion 1
. \" Start diversion in a new environment.
+. nr an*is-in-link-text-diversion 1
. ev an*link-text-env
. if '\*[.T]'pdf' \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
. di an*link-text
@@ -1148,7 +1150,7 @@ contains unsupported escape sequence
. br
. di
. ev
-.
+. nr an*is-in-link-text-diversion 0
. \" Was any link text present?
. ie \\n[dn] \{\
. if '\*[.T]'html' \
@@ -1193,7 +1195,6 @@ contains unsupported escape sequence
. hy \\n[an*hyphenation-mode]
. \}
. rm an*link-text
-. rr an*is-in-link-text-diversion
..
.
.\" Begin email hyperlink. Input until the next `ME` call is stored in
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 12/14: [man]: Refactor diversion management (7/7).,
G. Branden Robinson <=