groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/03: tmac/troffrc{,-end}: Improve style.


From: G. Branden Robinson
Subject: [groff] 03/03: tmac/troffrc{,-end}: Improve style.
Date: Thu, 14 Jan 2021 22:16:43 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit a248aa33967f034934c1ae97b188727294af1059
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Jan 15 13:49:02 2021 +1100

    tmac/troffrc{,-end}: Improve style.
    
    Follow established idioms and make them consistent with each other.
    
    * tmac/troffrc:
    * tmac/troffrc-end:
      + Identify files in header comments as part of GNU troff.
    
    * tmac/troffrc:
      + Clarify purpose of .do request.
      + Identify .X (set by groff -X) as a register, not a string.
      + Remove temporary registers one per line to make
        synchronization with foregoing logic easier.  Fixes name
        space management nits: an undefined string troffrc!Xps was
        being removed, and troffrc!{ascii,latin1,utf8,cp1047} were
        not being removed despite being defined.
    
    * tmac/troffrc-end:
      + Clarify that file is read after -m file arguments (not "all
        macro sets", which can be loaded with .mso after this file
        is processed).
      + Advise usage of .do for groff extensions.
      + Line-break one-off conditionals as troffrc does.
      + Add empty string comment to empty string definitions.
      + Add editor configuration comments.
---
 ChangeLog        | 27 +++++++++++++++++++++++++++
 tmac/troffrc     | 27 ++++++++++++++++++++-------
 tmac/troffrc-end | 52 +++++++++++++++++++++++++++++-----------------------
 3 files changed, 76 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f603bab..3aed97d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2021-01-15  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Improve style of troffrc{,-end} files.  Follow established
+       idioms and make them consistent with each other.
+
+       * tmac/troffrc:
+       * tmac/troffrc-end:
+         + Identify files in header comments as part of GNU troff.
+
+       * tmac/troffrc:
+         + Clarify purpose of .do request.
+         + Identify .X (set by groff -X) as a register, not a string.
+         + Remove temporary registers one per line to make
+           synchronization with foregoing logic easier.  Fixes name
+           space management nits: an undefined string troffrc!Xps was
+           being removed, and troffrc!{ascii,latin1,utf8,cp1047} were
+           not being removed despite being defined.
+
+       * tmac/troffrc-end:
+         + Clarify that file is read after -m file arguments (not "all
+           macro sets", which can be loaded with .mso after this file
+           is processed).
+         + Advise usage of .do for groff extensions.
+         + Line-break one-off conditionals as troffrc does.
+         + Add empty string comment to empty string definitions.
+         + Add editor configuration comments.
+
 2021-01-14  Dave Kemper <saint.snit@gmail.com>
 
        Commit 87edb525, from 2003, added character U+2026 (HORIZONTAL
diff --git a/tmac/troffrc b/tmac/troffrc
index c35f0c8..2ba343e 100644
--- a/tmac/troffrc
+++ b/tmac/troffrc
@@ -1,4 +1,6 @@
-.\" Startup file for troff.
+.\" startup file for GNU troff
+.\"
+.\" Use .do for any groff extensions so that this file works with -C.
 .
 .\" This is tested by pic.
 .nr 0p 0
@@ -9,9 +11,8 @@
 .\" Load generic fallback mappings.
 .do mso fallbacks.tmac
 .
-.\" Use .do here, so that it works with -C.
-.\" The groff command defines the .X string if the -X option was given.
-.do ie r.X \
+.\" The groff command defines the .X register if -X was given.
+.do ie r .X \
 .      do ds troffrc!ps Xps.tmac
 .el \
 .      do ds troffrc!ps ps.tmac
@@ -30,9 +31,21 @@
 .do ds troffrc!html html.tmac
 .do if d troffrc!\*[.T] \
 .      do mso \*[troffrc!\*[.T]]
-.do rm troffrc!ps troffrc!Xps troffrc!dvi troffrc!X75 troffrc!X75-12 \
-troffrc!X100 troffrc!X100-12 troffrc!lj4 troffrc!lbp troffrc!html \
-troffrc!pdf
+.do rm \
+troffrc!ps \
+troffrc!pdf \
+troffrc!dvi \
+troffrc!X75 \
+troffrc!X75-12 \
+troffrc!X100 \
+troffrc!X100-12 \
+troffrc!ascii \
+troffrc!latin1 \
+troffrc!utf8 \
+troffrc!cp1047 \
+troffrc!lj4 \
+troffrc!lbp \
+troffrc!html
 .
 .\" Test whether we work under EBCDIC and map the no-breakable space
 .\" character accordingly.
diff --git a/tmac/troffrc-end b/tmac/troffrc-end
index e8a3ba6..41b4400 100644
--- a/tmac/troffrc-end
+++ b/tmac/troffrc-end
@@ -1,28 +1,34 @@
-.\" -*- nroff -*-
+.\" final startup file for GNU troff
 .\"
-.\" final startup file for troff
-.
-.\" this file is parsed after all macro sets have been read
+.\" This file is parsed after all -m file arguments have been read.
+.\"
+.\" Use .do for any groff extensions so that this file works with -C.
 .
-.do if '\*[.T]'html' .do mso html-end.tmac
+.do if '\*[.T]'html' \
+.      do mso html-end.tmac
 .
-.\" if we are running the postscript device for html images then load www.tmac
-.do if r ps4html     .do mso www.tmac
+.\" Load www if we are running the PostScript driver for HTML images.
+.do if r ps4html \
+       .do mso www.tmac
 .
-.\" for all other devices blank out these macros
-.do if !d HTML-IMAGE-INLINE      .do ds HTML-IMAGE-INLINE
-.do if !d HTML-IMAGE             .do ds HTML-IMAGE
-.do if !d HTML-IMAGE-RIGHT       .do ds HTML-IMAGE-RIGHT
-.do if !d HTML-IMAGE-LEFT        .do ds HTML-IMAGE-LEFT
-.do if !d HTML-IMAGE-END         .do ds HTML-IMAGE-END
-.do if !d DEVTAG                 .do ds DEVTAG
-.do if !d HTML-DO-IMAGE          .do ds HTML-DO-IMAGE
-.do if !d EQN-HTML-IMAGE-END     .do ds EQN-HTML-IMAGE-END
-.do if !d EQN-HTML-IMAGE         .do ds EQN-HTML-IMAGE
-.do if !d EQN-HTML-IMAGE-RIGHT   .do ds EQN-HTML-IMAGE-RIGHT
-.do if !d EQN-HTML-IMAGE-LEFT    .do ds EQN-HTML-IMAGE-LEFT
-.do if !d EQN-HTML-IMAGE-INLINE  .do ds EQN-HTML-IMAGE-INLINE
-.do if !d EQN-HTML-DO-IMAGE      .do ds EQN-HTML-DO-IMAGE
-.do if !d EQN-HTML-IMAGE-END     .do ds EQN-HTML-IMAGE-END
+.\" For all other devices, make these macros no-ops.
+.do if !d HTML-IMAGE-INLINE      .do ds HTML-IMAGE-INLINE \" empty
+.do if !d HTML-IMAGE             .do ds HTML-IMAGE \" empty
+.do if !d HTML-IMAGE-RIGHT       .do ds HTML-IMAGE-RIGHT \" empty
+.do if !d HTML-IMAGE-LEFT        .do ds HTML-IMAGE-LEFT \" empty
+.do if !d HTML-IMAGE-END         .do ds HTML-IMAGE-END \" empty
+.do if !d DEVTAG                 .do ds DEVTAG \" empty
+.do if !d HTML-DO-IMAGE          .do ds HTML-DO-IMAGE \" empty
+.do if !d EQN-HTML-IMAGE-END     .do ds EQN-HTML-IMAGE-END \" empty
+.do if !d EQN-HTML-IMAGE         .do ds EQN-HTML-IMAGE \" empty
+.do if !d EQN-HTML-IMAGE-RIGHT   .do ds EQN-HTML-IMAGE-RIGHT \" empty
+.do if !d EQN-HTML-IMAGE-LEFT    .do ds EQN-HTML-IMAGE-LEFT \" empty
+.do if !d EQN-HTML-IMAGE-INLINE  .do ds EQN-HTML-IMAGE-INLINE \" empty
+.do if !d EQN-HTML-DO-IMAGE      .do ds EQN-HTML-DO-IMAGE \" empty
+.do if !d EQN-HTML-IMAGE-END     .do ds EQN-HTML-IMAGE-END \" empty
 .
-.\" Don't let blank lines creep in here.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:



reply via email to

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