groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/02: [man]: Don't enforce tag separation on `IP`.


From: G. Branden Robinson
Subject: [groff] 02/02: [man]: Don't enforce tag separation on `IP`.
Date: Wed, 22 Nov 2023 02:37:51 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit cba927a37a749cf912a183496002d8545d7619d5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Nov 20 08:33:57 2023 -0600

    [man]: Don't enforce tag separation on `IP`.
    
    The tags to `IP` macros are often very short, as with bullets or list
    enumerators (and in fact we encourage this practice in our style advice,
    promoting `TP` for definition lists and similar).  We therefore don't
    want to enforce the `TS` tag separation for them.  `.IP \[bu] 2n` is a
    perfectly cromulent usage pattern.
    
    * tmac/an.tmac: Add new Boolean-valued register,
      `an*enforce-tag-separation` to control this aspect of state.
      Initialize it true.
      (an-write-paragraph-tag): Multiply `TS` by this register to apply
      enforcement (or not).
      (IP): Temporarily clear register while setting paragraph.
    
    * tmac/groff_man.7.man.in (Paragraphing macros, Options):
    * NEWS: Update documentation.
---
 ChangeLog               | 20 ++++++++++++++++++++
 NEWS                    |  8 ++++----
 tmac/an.tmac            |  7 ++++++-
 tmac/groff_man.7.man.in | 11 ++++++-----
 4 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8010ca0fe..22fa68ee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2023-11-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Don't enforce tag separation on `IP`.
+
+       The tags to `IP` macros are often very short, as with bullets or
+       list enumerators (and in fact we encourage this practice in our
+       style advice, promoting `TP` for definition lists and similar).
+       We therefore don't want to enforce the `TS` tag separation for
+       them.  `.IP \[bu] 2n` is a perfectly cromulent usage pattern.
+
+       * tmac/an.tmac: Add new Boolean-valued register,
+       `an*enforce-tag-separation` to control this aspect of state.
+       Initialize it true.
+       (an-write-paragraph-tag): Multiply `TS` by this register to
+       apply enforcement (or not).
+       (IP): Temporarily clear register while setting paragraph.
+
+       * tmac/groff_man.7.man.in (Paragraphing macros, Options):
+       * NEWS: Update documentation.
+
 2023-11-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [build]: In source files that #include <assert.h>, ensure that
diff --git a/NEWS b/NEWS
index 65dc8617e..69f04f28f 100644
--- a/NEWS
+++ b/NEWS
@@ -89,10 +89,10 @@ o The an (man) and doc (mdoc) macro packages now support a 
`PO` register
   to configure the page offset used by the formatter.
 
 o The an (man) macro package now supports a `TS` register to configure
-  the minimum space required between a paragraph's tag and its body.
-  (If the width of the tag's formatted text plus this space exceeds the
-  paragraph indentation, the line is broken after the tag.)  This
-  parameter, formerly hard-coded as `1n`, now defaults to `2n`.
+  the minimum space required between the tag of a `TP` paragraph and its
+  body.  (If the width of the tag's formatted text plus this space
+  exceeds the paragraph indentation, the line is broken after the tag.)
+  This parameter, formerly hard-coded as `1n`, now defaults to `2n`.
 
 o The an (man) and doc (mdoc) macro packages now use slightly different
   vertical margins when formatting for typesetters, to align more
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 1a730cf6a..4ecc60e82 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -632,7 +632,8 @@ contains unsupported escape sequence
 .  ne (2v + 1u)
 .  \" Does the tag fit within the paragraph indentation?
 .  nr an-tag-fits \
-     (\\n[dl] + \\n[TS] <= \\n[an-prevailing-indent])
+     (\\n[dl] + (\\n[TS]*\\n[an*enforce-tag-separation]) \
+        <= \\n[an-prevailing-indent])
 .  if \\n[an-tag-fits] .DEVTAG-COL 1
 .  an-div
 .  if \\n[an-tag-fits] .sp -1v
@@ -804,6 +805,7 @@ contains unsupported escape sequence
 .\" Set an indented paragraph.
 .\" .IP [marker[ indentation-amount]]
 .de1 IP
+.  nr an*enforce-tag-separation 0
 .  an-break-paragraph
 .  ie !\\n[.$] \{\
 .    ne (1v + 1u)
@@ -814,6 +816,7 @@ contains unsupported escape sequence
 .    el               .TP
 .    nop \&\\$1
 .  \}
+.  nr an*enforce-tag-separation 1
 ..
 .
 .\" Set a paragraph with a hanging indentation.
@@ -1310,6 +1313,8 @@ contains unsupported escape sequence
 .nr an-devtag-needs-end-of-heading 0
 .nr an-devtag-needs-second-column 0
 .
+.nr an*enforce-tag-separation 1
+.
 .\" Track whether the strings that set header and footer text need to be
 .\" reconfigured.  This happens when batch-rendering and starting a new
 .\" page.
diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in
index c640c39da..04fa17323 100644
--- a/tmac/groff_man.7.man.in
+++ b/tmac/groff_man.7.man.in
@@ -943,11 +943,14 @@ arguments,
 if present,
 are handled as with
 .BR .TP ,
-with the exception that the
+except that the
 .I tag
 argument to
 .B .IP
-cannot `include' a macro call.
+cannot `include' a macro call,
+and the tag separation amount stored in the
+.B TS
+register is not enforced.
 .
 .
 _ifstyle()dnl
@@ -3722,9 +3725,7 @@ The default is\~3n.
 .BI \-rTS= separation
 Require the given
 .I separation
-between an
-.B IP
-or
+between a
 .B TP
 paragraph's tag and its body.
 .



reply via email to

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