groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/25: [man,mdoc,me]: Revise hyphenation localization.


From: G. Branden Robinson
Subject: [groff] 02/25: [man,mdoc,me]: Revise hyphenation localization.
Date: Wed, 2 Mar 2022 05:12:05 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 920fff1cf59d38bacd9b1b99b3d1ce3ce4e1e13f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Feb 23 00:55:29 2022 +1100

    [man,mdoc,me]: Revise hyphenation localization.
    
    * tmac/an.tmac (an*reset-hyphenation-mode): New macro sets the
      hyphenation mode appropriate to the locale depending on the values of
      `cR` (continuous rendering mode) and `HY` (hyphenation enablement);
      the latter is now interpreted as a Boolean.  Define new register
      `an*hyphenation-mode` reflecting these conditions.
    
      (TH): Call the foregoing instead of invoking `hy` request.
    
      (MR): Restore hyphenation mode to `an*hyphenation-mode`.
    
      (initializtion): Simplify; if not defined, set `HY` to 1.
    
    * tmac/e.tmac (ld): Set the hyphenation mode here instead of in
      initialization (which already calls this macro).  Set the mode to 6
      for the benefit of anyone borrowing our me(7) changes, but then
      immediately change to the mode determinated by the localization file.
    
    * tmac/mdoc/doc-common (doc-hyphen-flags): Set an hyphenation mode
      appropriate to the locale depending on the values of `cR` and `HY`.
    * tmac/mdoc/doc-ditroff:
    * tmac/mdoc/doc-nroff: Simplify initialization; if not defined, set `HY`
      to 1.
    
    * tmac/cs.tmac:
    * tmac/de.tmac:
    * tmac/en.tmac:
    * tmac/fr.tmac:
    * tmac/it.tmac:
    * tmac/sv.tmac: Before switching locales, set a flag if troublesome bit
      2 of the hyphenation mode is set so that we can preserve it.  Shift
      man(7) and me(7) logic to follow setup of the new hyphenation mode;
      for the former, call the new `an*reset-hyphenation-mode`.
    
    * tmac/groff_man.7.man.in:
    * tmac/groff_mdoc.7.man: Document updated meaning of `HY` register.
    
    * NEWS: Add item noting change of man(7) `HY`'s meaning.  Update
      existing item regarding mdoc(7)'s support for it (groff 1.22.4 mdoc(7)
      didn't recognize the register at all).
    
    Fixes <https://savannah.gnu.org/bugs/?61734> (for real this time?).
---
 ChangeLog               | 48 ++++++++++++++++++++++++++++++++++++++++++++
 NEWS                    | 11 +++++++---
 tmac/an.tmac            | 26 ++++++++++++++++--------
 tmac/cs.tmac            | 53 +++++++++++++++++++++++++++++--------------------
 tmac/de.tmac            | 52 ++++++++++++++++++++++++++++--------------------
 tmac/e.tmac             |  6 +++++-
 tmac/en.tmac            | 39 +++++++++++++++++++++++++++++-------
 tmac/fr.tmac            | 45 ++++++++++++++++++++++++++++-------------
 tmac/groff_man.7.man.in | 22 +++++++-------------
 tmac/groff_mdoc.7.man   | 12 ++++++++---
 tmac/it.tmac            | 51 +++++++++++++++++++++++++++--------------------
 tmac/mdoc/doc-common    |  9 +++++----
 tmac/mdoc/doc-ditroff   |  8 +-------
 tmac/mdoc/doc-nroff     | 10 +++-------
 tmac/sv.tmac            | 52 ++++++++++++++++++++++++++++--------------------
 15 files changed, 290 insertions(+), 154 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 12455d0f..7548d837 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2022-02-23  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man,mdoc,me]: Revise hyphenation localization.
+
+       * tmac/an.tmac (an*reset-hyphenation-mode): New macro sets the
+       hyphenation mode appropriate to the locale depending on the
+       values of `cR` (continuous rendering mode) and `HY` (hyphenation
+       enablement); the latter is now interpreted as a Boolean.  Define
+       new register `an*hyphenation-mode` reflecting these conditions.
+       (TH): Call the foregoing instead of invoking `hy` request.
+       (MR): Restore hyphenation mode to `an*hyphenation-mode`.
+       (initializtion): Simplify; if not defined, set `HY` to 1.
+
+       * tmac/e.tmac (ld): Set the hyphenation mode here instead of in
+       initialization (which already calls this macro).  Set the mode
+       to 6 for the benefit of anyone borrowing our me(7) changes, but
+       then immediately change to the mode determinated by the
+       localization file.
+
+       * tmac/mdoc/doc-common (doc-hyphen-flags): Set an hyphenation
+       mode appropriate to the locale depending on the values of `cR`
+       and `HY`.
+       * tmac/mdoc/doc-ditroff:
+       * tmac/mdoc/doc-nroff: Simplify initialization; if not defined,
+       set `HY` to 1.
+
+       * tmac/cs.tmac:
+       * tmac/de.tmac:
+       * tmac/en.tmac:
+       * tmac/fr.tmac:
+       * tmac/it.tmac:
+       * tmac/sv.tmac: Before switching locales, set a flag if
+       troublesome bit 2 of the hyphenation mode is set so that we can
+       preserve it.  Shift man(7) and me(7) logic to follow setup of
+       the new hyphenation mode; for the former, call the new
+       `an*reset-hyphenation-mode`.
+
+       * tmac/groff_man.7.man.in:
+       * tmac/groff_mdoc.7.man: Document updated meaning of `HY`
+       register.
+
+       * NEWS: Add item noting change of man(7) `HY`'s meaning.  Update
+       existing item regarding mdoc(7)'s support for it (groff 1.22.4
+       mdoc(7) didn't recognize the register at all).
+
+       Fixes <https://savannah.gnu.org/bugs/?61734> (for real this
+       time?).
+
 2022-02-22  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man]: Regression-test Savannah #61734.
diff --git a/NEWS b/NEWS
index 7885fb77..96f09ace 100644
--- a/NEWS
+++ b/NEWS
@@ -227,6 +227,11 @@ o The an (man) macro package no longer honors an `ll` 
request to set the
   vary the line length freely (DWB troff, Solaris troff, Plan 9 troff)
   or at all (mandoc, Heirloom Doctools troff).
 
+o The an (man) macro package now interprets the value of the `HY`
+  register as a Boolean; using it to set specific hyphenation mode
+  is no longer supported.  The groff command-line option `-rHY=0`
+  continues to disable automatic hyphenation of man page text as before.
+
 o The groff_man(7) man page documenting the groff implementation of the
   an (man) macro package has been split into two pages.  The original
   page remains as a terser reference for experienced users.  A new page,
@@ -235,9 +240,9 @@ o The groff_man(7) man page documenting the groff 
implementation of the
   reader who is not an expert in *roff systems or in writing man pages.
 
 o The doc (mdoc) macro package now honors the HY register as the an
-  (man) package does: to set the default hyphenation mode.  It
-  furthermore recognizes the `AD` string (see above) for compatibility
-  with an (man), but at present ignores its value.
+  (man) package does.  It furthermore recognizes the `AD` string (see
+  above) for compatibility with an (man), but at present ignores its
+  value.
 
 o The e (me) macro package has changed its support for output line
   numbering with the `n1` and `n2` macros to resolve several bugs in the
diff --git a/tmac/an.tmac b/tmac/an.tmac
index a9e18286..f5b91869 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -138,6 +138,19 @@
 .  em an-end
 ..
 .
+.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
+.  hy \\n[an*hyphenation-mode]
+..
+.
 .de an-reset-tab-stops
 .  ta T .5i
 ..
@@ -239,13 +252,13 @@
 .  ps \\n[PS]u
 .  vs \\n[VS]u
 .  ad \\*[AD]
-.  hy \\n[HY]
 .  ll \\n[LL]u
 .
 .  \" We've seen no tbl(1) tables yet in this document.
 .  rr TW
 .  nr an-was-tbl-failure-reported 0
 .
+.  an*reset-hyphenation-mode
 .  an-reset-tab-stops
 .  an-reset-paragraph-spacing
 .  an-reset-margin-and-inset-level
@@ -984,7 +997,7 @@
 \X^tty: link^\c
 .  \}
 \&\\$3
-.  hy \\n[HY]
+.  hy \\n[an*hyphenation-mode]
 ..
 .
 .\" tbl(1) table support
@@ -1194,12 +1207,9 @@
 .  \}
 .\}
 .
-.\" hyphenation mode
-.if !r HY \{\
-.  \" No page breaks occur in continuous rendering.
-.  ie \n[cR] .nr HY 4
-.  el        .nr HY 6
-.\}
+.\" hyphenation enablement
+.if !r HY \
+.  nr HY 1
 .
 .\" standard indentation
 .if !r IN \{\
diff --git a/tmac/cs.tmac b/tmac/cs.tmac
index d7050866..725c1cf1 100644
--- a/tmac/cs.tmac
+++ b/tmac/cs.tmac
@@ -1,6 +1,6 @@
 .\" Czech localization for groff
 .\"
-.\" Copyright (C) 2007-2020 Free Software Foundation, Inc.
+.\" Copyright (C) 2007-2022 Free Software Foundation, Inc.
 .\"   Written by Marcela Ma�l��ov� (mmaslano@redhat.com)
 .\"
 .\" This file is part of groff.
@@ -25,6 +25,14 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale czech\"
 .
 .
@@ -114,13 +122,6 @@
 .mso trans.tmac
 .
 .
-.\" man package
-.if d an \{\
-.      ie \n[cR] .nr HY 1
-.      el        .nr HY 2
-.\}
-.
-.
 .\" ms package
 .if r GS \{\
 .      \" update the date
@@ -151,27 +152,23 @@
 .\}
 .
 .
-.\" me package
-.if d @R \{\
-.      ds _td_format \En(dy \E*(mo \En(y4
-.      ld
-.\}
-.
-.
 .\" Default encoding
 .mso latin2.tmac
 .
 .ss 12 0
 .
+.\" Set up hyphenation.
+.
 .\" Czech hyphenation (\lefthyphenmin=2, \righthyphenmin=2)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 2
+.nr \*[locale]*hyphenation-mode-base 1
+.nr \*[locale]*hyphenation-mode-trap 2
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 1
-.\}
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hcode � �  � �
 .hcode � �  � �
@@ -194,6 +191,18 @@
 .hpfa hyphenex.cs
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \En(dy \E*(mo \En(y4
+.      ld
+.\}
+.
+.
 .cp \n[*groff_cs_tmac_C]
 .do rr *groff_cs_tmac_C
 .
diff --git a/tmac/de.tmac b/tmac/de.tmac
index 3690349c..aaa97cb3 100644
--- a/tmac/de.tmac
+++ b/tmac/de.tmac
@@ -1,6 +1,6 @@
 .\" German localization for groff
 .\"
-.\" Copyright (C) 2006-2020 Free Software Foundation, Inc.
+.\" Copyright (C) 2006-2022 Free Software Foundation, Inc.
 .\"   Written by Werner Lemberg (wl@gnu.org)
 .\"
 .\" This file is part of groff.
@@ -25,6 +25,14 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale german\"
 .
 .
@@ -114,13 +122,6 @@
 .mso trans.tmac
 .
 .
-.\" man package
-.if d an \{\
-.      ie \n[cR] .nr HY 1
-.      el        .nr HY 2
-.\}
-.
-.
 .\" ms package
 .if r GS \{\
 .      \" update the date
@@ -151,26 +152,23 @@
 .\}
 .
 .
-.\" me package
-.if d @R \{\
-.      ds _td_format \En(dy.\~\E*(mo.\& \En(y4
-.      ld
-.\}
-.
-.
 .\" Default encoding
 .mso latin1.tmac
 .
 .ss 12 0
 .
+.\" Set up hyphenation.
+.
 .\" German hyphenation (\lefthyphenmin=2, \righthyphenmin=2)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 2
+.nr \*[locale]*hyphenation-mode-base 1
+.nr \*[locale]*hyphenation-mode-trap 2
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 1
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hcode � �  � �  � �  � �  � �  � �  � �
 .hcode � �
@@ -197,6 +195,18 @@
 .  hpf hyphen.det
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \En(dy.\~\E*(mo.\& \En(y4
+.      ld
+.\}
+.
+.
 .cp \n[*groff_de_tmac_C]
 .do rr *groff_de_tmac_C
 .
diff --git a/tmac/e.tmac b/tmac/e.tmac
index dd466748..aca80fce 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -2006,10 +2006,14 @@
 .do ds dw \\*[_dw\\n(dw]
 .do ds mo \\*[_mo\\n(mo]
 .do ds td \\*[_td_format]
+.
+.\" Set package default hyphenation mode, but override it with groff's
+.\" localized value if available.
+.hy 6
+.do hy \\n[\\*[locale]*hyphenation-mode-trap]
 ..
 .
 .ld
-.hy 6
 .
 .\"            *** PARAMETRIC INITIALIZATIONS ***
 .
diff --git a/tmac/en.tmac b/tmac/en.tmac
index 45dafa40..441ca299 100644
--- a/tmac/en.tmac
+++ b/tmac/en.tmac
@@ -1,6 +1,7 @@
 .\" English localization for groff
 .\"
-.\" Copyright (C) 2021 Free Software Foundation, Inc.
+.\" Copyright (C) 2021-2022 Free Software Foundation, Inc.
+.\"   Written by G. Branden Robinson <g.branden.robinson.@gmail.com>
 .\"
 .\" This file is part of groff.
 .\"
@@ -24,24 +25,48 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale english\"
 .
 .ss 12
 .
+.\" Set up hyphenation.
+.
 .\" English hyphenation (\lefthyphenmin=2, \righthyphenmin=3)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 6
+.nr \*[locale]*hyphenation-mode-base 4
+.nr \*[locale]*hyphenation-mode-trap 6
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 4
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hla en
 .hpf hyphen.en
 .hpfa hyphenex.en
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \\*(mo \\n(dy, \\n(y4\"
+.      ld
+.\}
+.
+.
 .cp \n[*groff_en_tmac_C]
 .do rr *groff_en_tmac_C
 .
diff --git a/tmac/fr.tmac b/tmac/fr.tmac
index 0d81c436..c4719d15 100644
--- a/tmac/fr.tmac
+++ b/tmac/fr.tmac
@@ -1,6 +1,6 @@
 .\" French localization for groff
 .\"
-.\" Copyright (C) 2006-2020 Free Software Foundation, Inc.
+.\" Copyright (C) 2006-2022 Free Software Foundation, Inc.
 .\"   Written by Fabrice M�nard (menard.fabrice@wanadoo.fr)
 .\"
 .\" This file is part of groff.
@@ -25,6 +25,14 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale french\"
 .
 .
@@ -144,26 +152,23 @@
 .\}
 .
 .
-.\" me package
-.if d @R \{\
-.      ds _td_format \En(dy \E*(mo \En(y4
-.      ld
-.\}
-.
-.
 .\" Default encoding
 .mso latin9.tmac
 .
 .ss 12 0
 .
+.\" Set up hyphenation.
+.
 .\" French hyphenation (\lefthyphenmin=2, \righthyphenmin=3)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 6
+.nr \*[locale]*hyphenation-mode-base 4
+.nr \*[locale]*hyphenation-mode-trap 6
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 4
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hcode � �  � �
 .hcode � �  � �
@@ -185,6 +190,18 @@
 .hpf hyphen.fr
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \En(dy \E*(mo \En(y4
+.      ld
+.\}
+.
+.
 .cp \n[*groff_fr_tmac_C]
 .do rr *groff_fr_tmac_C
 .
diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in
index 490ca62e..642bccac 100644
--- a/tmac/groff_man.7.man.in
+++ b/tmac/groff_man.7.man.in
@@ -3284,23 +3284,15 @@ See
 .
 .
 .TP
-.BI \-rHY= hyphenation-mode
-Set hyphenation mode,
-as documented in section \(lqHyphenation\(rq of
-.MR groff @MAN7EXT@ .
-.
-Use
 .B \-rHY=0
-to disable hyphenation.
+Disable automatic hyphenation.
 .
-The default is\~4 if continuous rendering is enabled
-.RB ( \-rcR=1
-above),
-and\~6 otherwise.
-.
-Any valid argument to
-.IR groff 's
-\[lq].hy\[rq] request may be used.
+Normally,
+it is enabled using a mode appropriate to the
+.I groff
+locale;
+see section \[lq]Localization\[lq] of
+.MR groff @MAN7EXT@ .
 .
 .
 .TP
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index ab3348bc..50a462b6 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -4786,10 +4786,16 @@ both registers default to 78n for terminal devices and 
6.5i otherwise.
 .
 .
 .Pp
-Hyphenation can be disabled with the
+Normally,
+automatic hyphenation is enabled using a mode appropriate to the
+.Nm groff
+locale;
+see section \[lq]Localization\[lq] of
+.Xr groff @MAN7EXT@ .
+.
+It can be disabled by setting the
 .Ql HY
-register
-(though any permissible hyphenation mode may be used).
+register to zero.
 .
 .
 .Pp
diff --git a/tmac/it.tmac b/tmac/it.tmac
index 29e385f8..0cec5291 100644
--- a/tmac/it.tmac
+++ b/tmac/it.tmac
@@ -1,6 +1,6 @@
 .\" Italian localization for groff
 .\"
-.\" Copyright (C) 2021 Free Software Foundation, Inc.
+.\" Copyright (C) 2021-2022 Free Software Foundation, Inc.
 .\"   Written by Edmond Orignac (edmond.orignac@wanadoo.fr)
 .\"
 .\" This file is part of groff.
@@ -25,6 +25,14 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale italian\"
 .
 .
@@ -114,13 +122,6 @@
 .mso trans.tmac
 .
 .
-.\" man package
-.if d an \{\
-.      ie \n[cR] .nr HY 1
-.      el        .nr HY 2
-.\}
-.
-.
 .\" ms package
 .if r GS \{\
 .      \" update the date
@@ -151,29 +152,37 @@
 .\}
 .
 .
-.\" me package
-.if d @R \{\
-.      ds _td_format \En(dy \E*(mo \En(y4
-.      ld
-.\}
-.
-.
 .ss 12 0
 .
+.\" Set up hyphenation.
 .
 .\" Italian hyphenation (\lefthyphenmin=2, \righthyphenmin=2)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 2
+.nr \*[locale]*hyphenation-mode-base 1
+.nr \*[locale]*hyphenation-mode-trap 2
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 1
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hla it
 .hpf hyphen.it
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \En(dy \E*(mo \En(y4
+.      ld
+.\}
+.
+.
 .cp \n[*groff_it_tmac_C]
 .do rr *groff_it_tmac_C
 .
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 08be3b09..6c840265 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -922,10 +922,11 @@
 .
 .\" NS doc-hyphen-flags global register
 .\" NS   the parameter for the '.hy' request
-.\" NS
-.\" NS override this in 'mdoc.local', if necessary.
-.
-.nr doc-hyphen-flags \n[HY]
+.ie \n[HY] \{\
+.  ie \n[cR] .nr doc-hyphen-flags \n[\*[locale]*hyphenation-mode-base]
+.  el        .nr doc-hyphen-flags \n[\*[locale]*hyphenation-mode-trap]
+.\}
+.el .nr doc-hyphen-flags 0
 .
 .
 .\" NS doc-header macro
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index a959aca1..85dafe1d 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -46,13 +46,7 @@
 .
 .\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
 .\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
-.if !r HY \{\
-.  \" No page breaks occur in continuous rendering.
-.  ie \n[cR] \
-.    nr HY 4
-.  el \
-.    nr HY 6
-.\}
+.if !r HY .nr HY 1
 .
 .\" use -rS={11,12} to change the font size from 10pt to 11pt or 12pt.
 .if !r S .nr S 10
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index 133b384d..e248e449 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -46,13 +46,9 @@
 .
 .\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
 .\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
-.if !r HY \{\
-.  \" No page breaks occur in continuous rendering.
-.  ie \n[cR] \
-.    nr HY 4
-.  el \
-.    nr HY 6
-.\}
+.\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
+.\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
+.if !r HY .nr HY 1
 .
 .\" If continuous rendering, tell tbl not to use keeps.
 .ie \n[cR] \
diff --git a/tmac/sv.tmac b/tmac/sv.tmac
index 3e210227..f2fbef40 100644
--- a/tmac/sv.tmac
+++ b/tmac/sv.tmac
@@ -1,6 +1,6 @@
 .\" Swedish localization for groff
 .\"
-.\" Copyright (C) 2006-2020 Free Software Foundation, Inc.
+.\" Copyright (C) 2006-2022 Free Software Foundation, Inc.
 .\"   Written by Werner Lemberg (wl@gnu.org)
 .\"
 .\" This file is part of groff.
@@ -25,6 +25,14 @@
 .cp 0
 .
 .
+.\" If changing from an existing locale, we need to preserve the state
+.\" of the "suppress hyphenation before a page location trap" bit.
+.nr locale*use-trap-hyphenation-mode 0
+.if d locale \
+.  if \n[.hy]=\n[\*[locale]*hyphenation-mode-trap] \
+.    nr locale*use-trap-hyphenation-mode 1
+.
+.
 .ds locale swedish\"
 .
 .
@@ -114,13 +122,6 @@
 .mso trans.tmac
 .
 .
-.\" man package
-.if d an \{\
-.      ie \n[cR] .nr HY 32
-.      el        .nr HY 34
-.\}
-.
-.
 .\" ms package
 .if r GS \{\
 .      \" update the date
@@ -133,26 +134,23 @@
 .\" mm package -- additional Swedish localization is done in mse.tmac
 .
 .
-.\" me package
-.if d @R \{\
-.      ds _td_format \En(dy \E*(mo \En(y4
-.      ld
-.\}
-.
-.
 .\" Default encoding
 .mso latin1.tmac
 .
 .ss 12 0
 .
+.\" Set up hyphenation.
+.
 .\" Swedish hyphenation (\lefthyphenmin=1, \righthyphenmin=2)
-.\"
-.\" Hyphenation value 2 (bit 1) may already have been set by troffrc or
-.\" a macro package; preserve it.
-.ie (\n[.hy]%2=0 & (\n[.hy]%4)) \
-.      hy 34
+.nr \*[locale]*hyphenation-mode-base 32
+.nr \*[locale]*hyphenation-mode-trap 34
+.
+.ie \n[locale*use-trap-hyphenation-mode] \
+.  hy \n[\*[locale]*hyphenation-mode-trap]
 .el \
-.      hy 32
+.  hy \n[\*[locale]*hyphenation-mode-base]
+.
+.rr locale*use-trap-hyphenation-mode
 .
 .hcode � �  � �
 .hcode � �  � �
@@ -163,6 +161,18 @@
 .hpf hyphen.sv
 .
 .
+.\" man package
+.if d an \
+.      an*reset-hyphenation-mode
+.
+.
+.\" me package
+.if d @R \{\
+.      ds _td_format \En(dy \E*(mo \En(y4
+.      ld
+.\}
+.
+.
 .cp \n[*groff_sv_tmac_C]
 .do rr *groff_sv_tmac_C
 .



reply via email to

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