groff-commit
[Top][All Lists]
Advanced

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

[groff] 09/15: tmac/an-old.tmac: Refactor complex conditional.


From: G. Branden Robinson
Subject: [groff] 09/15: tmac/an-old.tmac: Refactor complex conditional.
Date: Wed, 19 May 2021 11:00:39 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit a2f14c17b62ed8dff148a1815bd48319ebdd7ed8
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed May 19 22:58:26 2021 +1000

    tmac/an-old.tmac: Refactor complex conditional.
    
    * tmac/an-old.tmac (an-footer): Refactor complex conditional.
    
    Three of the four branches are tested by
    tmac/tests/an-old_X-register-works.sh; the fourth is tested by
    tmac/tests/an-old_page-footers-present.sh.
---
 ChangeLog        |  4 ++++
 tmac/an-old.tmac | 21 +++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2b87d56..072d386 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2021-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * tmac/an-old.tmac (an-footer): Refactor complex conditional.
+
+2021-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * tmac/tests/an-old_X-register-works.sh: Add test for footer
        creeping into page content.
 
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index cf637d4..a90726a 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -319,19 +319,16 @@
 .    ds an-extra2 \" empty
 .  \}
 .  el \{\
-.    ie r X \{\
-.      ie (\\n[%] > \\n[X]) \{\
-.        nr an-page-letter (\\n[%] - \\n[X])
-.        ds an-outer-footer-text \\n[X]\\n[an-page-letter]\"
-.      \}
-.      el \
-.        ds an-outer-footer-text \\n[%]\"
-.    \}
+.    ie \\n[cR] \
+.      ds an-outer-footer-text "\\*[an-title](\\*[an-section])\"
 .    el \{\
-.      ie \\n[cR] \
-.        ds an-outer-footer-text "\\*[an-title](\\*[an-section])\"
-.      el \
-.        ds an-outer-footer-text \\n[%]\"
+.      ds an-outer-footer-text \\n[%]\"
+.      if r X \{\
+.        if (\\n[%] > \\n[X]) \{\
+.          nr an-page-letter (\\n[%] - \\n[X])
+.          ds an-outer-footer-text \\n[X]\\n[an-page-letter]\"
+.        \}
+.      \}
 .    \}
 .  \}
 .  BT



reply via email to

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