gbranden pushed a commit to branch master
in repository groff.
commit dd643b408817908c777a726efcac40c25d3df499
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jul 15 21:51:01 2025 -0500
[man]: Refactor hyphenation mode handling.
* tmac/an.tmac: Refactor.
(an*reset-hyphenation-mode): Update to work if the `HY` register is
not defined. Use new local register `an*want-hyphenation` to
determine which hyphenation mode ultimately gets set (that of the
locale, or zero). Remove register when done.
([initialization]): Stop assigning `HY` register a default value if
it's unspecified by the user (on the command line or via "man.local").
* contrib/mom/groff_mom.1.man: Stop assuming `HY` string is defined in a
hairy bit of typesetting.
---
ChangeLog | 11 +++++++++++
contrib/mom/groff_mom.7.man | 4 +++-
tmac/an.tmac | 20 ++++++++------------
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index da6548ad3..0b9506d56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-07-15 G. Branden Robinson <[email protected]>
+
+ * tmac/an.tmac: Refactor.
+ (an*reset-hyphenation-mode): Update to work if the `HY` register
+ is not defined. Use new local register `an*want-hyphenation` to
+ determine which hyphenation mode ultimately gets set (that of
+ the locale, or zero). Remove register when done.
+ ([initialization]): Stop assigning `HY` register a default value
+ if it's unspecified by the user (on the command line or via
+ "man.local").
+
2025-07-23 G. Branden Robinson <[email protected]>
* tmac/an.tmac: Refactor.
diff --git a/contrib/mom/groff_mom.7.man b/contrib/mom/groff_mom.7.man
index 57cfbb4b8..7d8878aec 100644
--- a/contrib/mom/groff_mom.7.man
+++ b/contrib/mom/groff_mom.7.man
@@ -72,10 +72,12 @@ groff_mom \- modern macros for document composition with GNU
. shift 2
. \}
. if (\\n[.$] = 1) .as result \,\f[\\$1]
+. nr saved-hy \\n[.hy]
. nh
. nop \\*[result]\&
. rm result
-. hy \\n[HY]
+. hy \\n[saved-hy]
+. rr saved-hy
..
.
.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index ed3f4875a..695152b02 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -122,17 +122,15 @@
. el .an*break-page-with-new-number
..
.
+.\" `TH` and localization macro files call this.
.de an*reset-hyphenation-mode
-. ie \\n[HY] \{\
-. \" No page breaks occur in continuous rendering.
-. ie \\n[cR] \
-. nr an*hyphenation-mode \\n[\\*[locale]*hyphenation-mode-base]
-. el \
-. nr an*hyphenation-mode \\n[\\*[locale]*hyphenation-mode-trap]
-. \}
-. el \
-. nr an*hyphenation-mode 0
+. nr an*want-hyphenation 1
+. if r HY .if !\\n[HY] .nr an*want-hyphenation 0
+. ie \\n[an*want-hyphenation] \
+. nr an*hyphenation-mode \\n[\\*[locale]*hyphenation-mode-trap]
+. el .nr an*hyphenation-mode 0
. hy \\n[an*hyphenation-mode]
+. rr an*want-hyphenation
..
.
.de an*reset-tab-stops
@@ -1548,9 +1546,7 @@ contains unsupported escape sequence
. \}
.\}
.
-.\" hyphenation enablement
-.if !r HY \
-. nr HY 1
+.\" We handle `HY` in the `TH` macro definition, not here.
.
.\" standard indentation
.if !r IN \{\
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit