groff-commit
[Top][All Lists]
Advanced

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

[groff] 19/28: tmac/an-old.tmac (an-header): Lightly refactor.


From: G. Branden Robinson
Subject: [groff] 19/28: tmac/an-old.tmac (an-header): Lightly refactor.
Date: Sat, 19 Jun 2021 17:24:13 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit cded321461847a71c67ea50c9c3fdf5ce2ab2050
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jun 19 11:58:37 2021 +1000

    tmac/an-old.tmac (an-header): Lightly refactor.
    
    * tmac/an-old.tmac (an-header): Lightly refactor; tighten.
    
    I tend to dislike conditionals like this:
    
    if not condition
        stuff
    else
        other-stuff
    
    Why not put the affirmative case first?
---
 ChangeLog        |  4 ++++
 tmac/an-old.tmac | 11 ++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 964b1b9..82c97ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2021-06-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * tmac/an-old.tmac (an-header): Lightly refactor; tighten.
+
+2021-06-19  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * tmac/an-old.tmac (an-write-paragraph-tag): Lightly refactor
        for clarity and to reduce code duplicated in both branches of an
        `ie`/`el` structure.
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 56e691c..3bcab59 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -383,17 +383,14 @@
 .  lt \\n[LT]u
 .  an-abbreviate-title
 .  if !\\n[an-is-output-html] \{\
-.    if !\\n[cR] \
-.      sp .5i
-.    if \\n[cR] \
-.      pl +1v
+.    ie \\n[cR] .pl +1v
+.    el         .sp .5i
 .    PT
-.    ie !\\n[cR] \
-.      sp |1i
-.    el \{\
+.    ie \\n[cR] \{\
 .      pl +1v
 .      sp 1v
 .    \}
+.    el .sp |1i
 .  \}
 .  ev
 .  ns



reply via email to

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