groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/04: [man]: Slightly refactor.


From: G. Branden Robinson
Subject: [groff] 02/04: [man]: Slightly refactor.
Date: Sat, 9 Apr 2022 14:19:17 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 1a678bc66856e36255ae0b7da9a83fbc801ea909
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Apr 9 07:59:31 2022 +1000

    [man]: Slightly refactor.
    
    * tmac/an.tmac (an*abbreviate-inner-footer): Discard unnecessary string.
    
    Also update comments, including a misleading one about the above macro
    that was a relic of an earlier approach to resolving Savannah #62257.
---
 ChangeLog    |  7 +++++++
 tmac/an.tmac | 24 ++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 058ef4ff..4c646d45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-04-09  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Slightly refactor `an*abbreviate-inner-footer`.
+
+       * tmac/an.tmac (an*abbreviate-inner-footer): Discard
+       unnecessary string.
+
 2022-04-09  Ingo Schwarze <schwarze@openbsd.org>
 
        Fix the configuration of texi2dvi.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index e2a9785c..527053e1 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -456,7 +456,7 @@
 .    substring an-suffix (\\n[an-mark2] <? \\n[an-title-length] - 1) -1
 .    ds an-title-string \\*[an-prefix]\\*[an-suffix]\"
 .    ds an-title-abbv \\*[an-prefix]\\*[an-ellipsis]\\*[an-suffix]\"
-.    \" Measure the string again and give up if we made no progress.
+.    \" Remeasure the formatted title; give up if we made no progress.
 .    length an-title-new-length \\*[an-title-string]
 .    ie (\\n[an-title-new-length] >= \\n[an-title-length]) \
 .      break
@@ -482,11 +482,10 @@
 .\" caller should delete this register when done with it.
 .de an*scan-string-for-backslash
 .  nr an*string-contains-backslash 0
-.  ds an*string \\$*
 .  nr an*index 0
 .  length an*max-index \\$*
 .  while (\\n[an*index] < \\n[an*max-index]) \{\
-.    ds an*char \\*[an*string]
+.    ds an*char \\$*
 .    substring an*char \\n[an*index] \\n[an*index]
 .    ec @
 .    \" Use a weird delimiter to reduce lexical colorizer confusion.
@@ -501,17 +500,14 @@
 ..
 .
 .\" Abbreviate the `an-extra2` string (set by .TH) if it's too long for
-.\" the footer.  By default, `an-extra2` is placed as the inner footer.
-.\" We call it `an*ifoot` here and leave it defined for .BT use.
-.\" (`an*ofoot` is not treated the same way; it is regenerated by
-.\" `an-footer` on every page because it may have a page number in it,
-.\" which frequently changes.)
-.\"
-.\" Shorten the inner footer if necessary by trimming characters off the
-.\" end and replacing them with an ellipsis.  We don't yet know if the
-.\" outer footer will be a page number (short) or the page reference
-.\" (potentially long), so we take a pessimistic approach and assume the
-.\" latter.  The page title, `an-pageref`, must already be prepared.
+.\" the footer.  The formatted width of the inner footer plus half that
+.\" of the center footer must be less than half the title width or we
+.\" must abbreviate.  By default, `an-extra2` is placed as the inner
+.\" footer.  We call its (potential) abbreviation `an*ifoot` here and
+.\" leave it defined for .BT use.  (`an*ofoot` is not treated the same
+.\" way.  `an-footer` regenerates it on every page because the page
+.\" number changes if present.)  Shorten the inner footer if necessary
+.\" by trimming characters off the end, replacing them with an ellipsis.
 .de an*abbreviate-inner-footer
 .  ds an*ifoot \\*[an-extra2]\"
 .  nr an*half-title-width (\\n[.lt] / 2u)



reply via email to

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