groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 11/14: [man]: Refactor diversion management (6/7).


From: G. Branden Robinson
Subject: [groff] 11/14: [man]: Refactor diversion management (6/7).
Date: Mon, 29 Jan 2024 21:13:49 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit dfc2bc9c97f0dc16f018dcffd481c601372977e4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jan 29 16:59:01 2024 -0600

    [man]: Refactor diversion management (6/7).
    
    * tmac/an.tmac (TP): Throw warning if macro is nested with itself.
    
      (an*begin-hyperlink): Throw warning if hyperlink already inside
      diversion.
---
 ChangeLog    |  3 +++
 tmac/an.tmac | 17 +++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9e32b1fa8..2a812a9ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,9 @@
        (an-write-paragraph-tag, an*end-hyperlink): Delete diversions
        after using them.
        (an*end-hyperlink): Revise emission of link text diversion.
+       (TP): Throw warning if macro is nested with itself or `TQ`.
+       (an*begin-hyperlink): Throw warning if hyperlink already inside
+       diversion.
 
 2024-01-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 064956abb..f4bc1fcc3 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -813,13 +813,15 @@ contains unsupported escape sequence
 .  an-break-paragraph
 .  if \\n[.$] .nr an-prevailing-indent (n;\\$1)
 .  itc 1 an-input-trap
-.  in 0
-.  if !\\n[an*is-in-paragraph-tag-diversion] \{\
-.    ll -\\n[an-margin]u
-.    di an*paragraph-tag
-.    na
+.  if \\n[an*is-in-paragraph-tag-diversion] \{\
+.    an-warn cannot nest .\\$0 or .TQ inside .\\$0; supply a tag
+.    return
 .  \}
+.  in 0
+.  ll -\\n[an-margin]u
 .  nr an*is-in-paragraph-tag-diversion 1
+.  di an*paragraph-tag
+.  na
 ..
 .
 .\" Set an indented paragraph.
@@ -1120,7 +1122,10 @@ contains unsupported escape sequence
 .  \" 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'' .nr an*is-in-link-text-diversion 1
+.  if !'\\n[.z]'' \{\
+.    an-warn cannot nest .MT or .UR inside .TP; ending paragraph tag
+.    nr an*is-in-link-text-diversion 1
+.  \}
 .  if (\\n[an*is-in-link-text-diversion] & \\n[an*do-hyperlink]) \{\
 .    \" Start diversion in a new environment.
 .    ev an*link-text-env



reply via email to

[Prev in Thread] Current Thread [Next in Thread]