groff-commit
[Top][All Lists]
Advanced

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

[groff] 30/40: tmac/an-ext.tmac: Refactor to reduce code size.


From: G. Branden Robinson
Subject: [groff] 30/40: tmac/an-ext.tmac: Refactor to reduce code size.
Date: Sat, 12 Nov 2022 14:43:39 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit baee372fa9622c1e49d2d5f33e110f019b1b6742
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 11 17:09:52 2022 -0600

    tmac/an-ext.tmac: Refactor to reduce code size.
    
    * tmac/an-ext.tmac: Refactor to reduce code size.  `UR` and `MT` have
      identical implementations so...
    
      (mV): Define new macro to perform the requisite actions, and...
    
      (UR, MT): Make these into wrappers calling mV.
    
    Also update comment banner to drop bitrot-susceptible announcement of
    file name, and bump copyright date.
---
 ChangeLog        |  7 +++++++
 tmac/an-ext.tmac | 32 ++++++++++----------------------
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3403b74c6..fed930f8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-11-11  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an-ext.tmac: Refactor to reduce code size.  `UR` and `MT`
+       have identical implementations so...
+       (mV): Define new macro to perform the requisite actions, and...
+       (UR, MT): Make these into wrappers calling mV.
+
 2022-11-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/an-ext.tmac (UR, MT): Fix problem with incorrect line
diff --git a/tmac/an-ext.tmac b/tmac/an-ext.tmac
index acc219a1a..0fb4cd7a7 100644
--- a/tmac/an-ext.tmac
+++ b/tmac/an-ext.tmac
@@ -1,6 +1,6 @@
-.\" an-ext.tmac
+.\" groff extension macros for man(7) package
 .\"
-.\" Copyright (C) 2007-2021 Free Software Foundation, Inc.
+.\" Copyright (C) 2007-2022 Free Software Foundation, Inc.
 .\"
 .\" Written by Eric S. Raymond <esr@thyrsus.com>
 .\"            Werner Lemberg <wl@gnu.org>
@@ -98,9 +98,8 @@
 .  nr mS 0
 ..
 .
-.
-.\" Start URL.
-.de UR
+.\" Prepare link text for mail/web hyperlinks.  `MT` and `UR` call this.
+.de mV
 .  ds m1 \\$1\"
 .  \" Save the indentation and line length.  We want the diversion to
 .  \" format as if it has an indentation of zero (that comes for free
@@ -120,6 +119,11 @@
 .  rr mK
 ..
 .
+.\" Start URL.
+.de UR
+.  mV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
+..
+.
 .
 .\" End URL.
 .de UE
@@ -165,23 +169,7 @@
 .
 .\" Start email address.
 .de MT
-.  ds m1 \\$1\"
-.  \" Save the indentation and line length.  We want the diversion to
-.  \" format as if it has an indentation of zero (that comes for free
-.  \" when we switch environments), but we want the line length reduced
-.  \" by the amount of indentation that obtains when we output it.
-.  nr mK \\n(.l
-.  nr mI \\n(.i
-.  \" We can only hyperlink if we're not in a diversion.
-.  nr mD 0
-.  if '\\n(.z'' .nr mD 1
-.  if \\n(mD&\\nU&\\n(mU \{\
-.    \" Start diversion in a new environment.
-.    do ev link-text-env
-.    do di link-text-div
-.    ll (\\n(mKu-\\n(mIu)
-.  \}
-.  rr mK
+.  mV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
 ..
 .
 .



reply via email to

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