groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/03: mdoc: Honor HY register to control hyphenation.


From: G. Branden Robinson
Subject: [groff] 03/03: mdoc: Honor HY register to control hyphenation.
Date: Tue, 25 Aug 2020 09:17:50 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit b443e713cecefc553fc8d98b68de74b750f54bd8
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Aug 25 23:03:47 2020 +1000

    mdoc: Honor HY register to control hyphenation.
    
    Update mdoc package to honor HY register as man does now, per suggestion
    from Colin Watson.  Recognize but ignore AD string for man package
    compatibility (essentially "reserving" it), though mdoc intentionally
    does not permit configuration of adjustment.
    
    * tmac/mdoc/doc-ditroff-u:
    * tmac/mdoc/doc-nroff-u: Do it.
    
    * tmac/mdoc/doc-common-u: Initialize \n[doc-hyphen-flags] from \n[HY].
    
    * tmac/groff_mdoc.7.man (FORMATTING WITH GROFF, TROFF, AND NROFF):
      Document it.
    
    Tested using:
      ./build/test-groff -Tutf8 -t -mdoc -rHY=0 ./build/tmac/groff_mdoc.7
      ./build/test-groff -Tutf8 -t -mdoc ./build/tmac/groff_mdoc.7
---
 ChangeLog               | 17 +++++++++++++++++
 tmac/groff_mdoc.7.man   | 11 +++++++++++
 tmac/mdoc/doc-common-u  |  4 +++-
 tmac/mdoc/doc-ditroff-u | 18 +++++++++++++++---
 tmac/mdoc/doc-nroff-u   | 18 +++++++++++++++---
 5 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 26af27a..8a57ef8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2020-08-25  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       Update mdoc package to honor HY register as man does now, per
+       suggestion from Colin Watson.  Recognize but ignore AD string
+       for man package compatibility (essentially "reserving" it),
+       though mdoc intentionally does not permit configuration of
+       adjustment.
+
+       * tmac/mdoc/doc-ditroff-u:
+       * tmac/mdoc/doc-nroff-u: Do it.
+
+       * tmac/mdoc/doc-common-u: Initialize \n[doc-hyphen-flags] from
+       \n[HY].
+
+       * tmac/groff_mdoc.7.man \
+       (FORMATTING WITH GROFF, TROFF, AND NROFF): Document it.
+
+2020-08-25  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * tmac/an-old.tmac (TH): Reset inter-word and inter-sentence
        spacing to default with each new page rendered.
 
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index e9b5d9e..36ed1fc 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -4209,6 +4209,17 @@ respectively:
 .Pp
 If not set, both registers default to 78n for TTY devices and 6.5i
 otherwise.
+.Pp
+Hyphenation can be disabled with the
+.Ql HY
+register (though any permissible hyphenation mode may be used).
+.Pp
+.Dl groff \-Tutf8 -rHY=0 \-mdoc foo.man | less
+.Pp
+An
+.Ql AD
+string is also recognized, but ignored, for compatibility with
+.Xr groff_man 7 .
 .
 .
 .Sh FILES
diff --git a/tmac/mdoc/doc-common-u b/tmac/mdoc/doc-common-u
index bd20e2f..acb84d9 100644
--- a/tmac/mdoc/doc-common-u
+++ b/tmac/mdoc/doc-common-u
@@ -914,7 +914,9 @@
 .\" NS
 .\" NS override this in 'mdoc.local', if necessary.
 .
-.nr doc-hyphen-flags 4
+.ec
+.nr doc-hyphen-flags \n[HY]
+.eo
 .
 .
 .\" NS doc-header macro
diff --git a/tmac/mdoc/doc-ditroff-u b/tmac/mdoc/doc-ditroff-u
index ee5c1f7..bd87b16 100644
--- a/tmac/mdoc/doc-ditroff-u
+++ b/tmac/mdoc/doc-ditroff-u
@@ -36,16 +36,28 @@
 .
 .eo
 .
-.\" use -rD=1 for double-sided printing
+.\" \*[AD] is recognized for groff_man(7) compatibility, but ignored.
+.if !d AD .ds AD \"
 .
+.\" use -rD=1 for double-sided printing
 .if !r D .nr D 0
 .
 .\" use -rcR=1 to force the creation of a single, very long page
-.
 .if !r cR .nr cR 0
 .
-.\" use -rS={11,12} to change the font size from 10pt to 11pt or 12pt.
+.\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
+.\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
+.ec
+.if !r HY \{\
+.  \" No page breaks occur in continuous rendering.
+.  ie \n[cR] \
+.    nr HY 4
+.  el \
+.    nr HY 6
+.\}
+.eo
 .
+.\" 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-u b/tmac/mdoc/doc-nroff-u
index 6d37092..0814c31 100644
--- a/tmac/mdoc/doc-nroff-u
+++ b/tmac/mdoc/doc-nroff-u
@@ -36,16 +36,28 @@
 .
 .eo
 .
-.\" use -rD=1 for double-sided printing
+.\" \*[AD] is recognized for groff_man(7) compatibility, but ignored.
+.if !d AD .ds AD \"
 .
+.\" use -rD=1 for double-sided printing
 .if !r D .nr D 0
 .
 .\" use -rcR=0 for multiple pages instead of a single, very long page
-.
 .if !r cR .nr cR 1
 .
-.\" the following switch is ignored in nroff mode
+.\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
+.\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
+.ec
+.if !r HY \{\
+.  \" No page breaks occur in continuous rendering.
+.  ie \n[cR] \
+.    nr HY 4
+.  el \
+.    nr HY 6
+.\}
+.eo
 .
+.\" the following switch is ignored in nroff mode
 .nr S 10
 .
 .\" the 'doc-xx-font' strings must not be empty!



reply via email to

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