groff-commit
[Top][All Lists]
Advanced

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

[groff] 32/51: [mdoc]: Support `C` register as man(7) does.


From: G. Branden Robinson
Subject: [groff] 32/51: [mdoc]: Support `C` register as man(7) does.
Date: Sun, 11 Sep 2022 08:15:54 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 30115f3ba72801badda08cdbc0210cb0014ddc1e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Sep 7 21:53:34 2022 -0500

    [mdoc]: Support `C` register as man(7) does.
    
    * tmac/mdoc/doc-common (Dd): Reset page number to 1 upon new document
      only if not consecutively numbering.
    
    * tmac/mdoc/doc-ditroff:
    * tmac/mdoc/doc-nroff: Process `C` register setting from command line as
      man(7) does.
    
    * tmac/groff_mdoc.7.man (Formatting with groff, troff, and nroff):
      Document it.
    
    * NEWS: Expand existing item.
    
    Fixes part of <https://savannah.gnu.org/bugs/?63046>.
---
 ChangeLog             | 16 ++++++++++++++++
 NEWS                  |  4 ++--
 tmac/groff_mdoc.7.man |  9 +++++++++
 tmac/mdoc/doc-common  |  7 +++++--
 tmac/mdoc/doc-ditroff | 22 ++++++++++++++++++++++
 tmac/mdoc/doc-nroff   | 22 ++++++++++++++++++++++
 6 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index acf659cdb..846ae6dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2022-09-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mdoc]: Support `C` register for consecutive page numbering.
+
+       * tmac/mdoc/doc-common (Dd): Reset page number to 1 upon new
+       document only if not consecutively numbering.
+
+       * tmac/mdoc/doc-ditroff:
+       * tmac/mdoc/doc-nroff: Process `C` register setting from command
+       line as man(7) does.
+
+       * tmac/groff_mdoc.7.man (Formatting with groff, troff, and
+       nroff): Document it.
+
+       Fixes part of <https://savannah.gnu.org/bugs/?63046>.
+
 2022-09-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Align trap management more closely with man(7).
diff --git a/NEWS b/NEWS
index 57eead0af..5e068e3bf 100644
--- a/NEWS
+++ b/NEWS
@@ -282,8 +282,8 @@ o The groff_man(7) man page documenting the groff 
implementation of the
   material supplemented with explanations, examples, and advice for 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.  It furthermore recognizes the `AD` string (see
+o The doc (mdoc) macro package now honors the C and HY registers as the
+  an (man) package does.  It furthermore recognizes the `AD` string (see
   above) for compatibility with an (man), but at present ignores its
   value.
 
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index 9e219be1c..2b1ca8217 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -4693,6 +4693,15 @@ A normal user will never need it.
 .
 .Sh "Formatting with groff, troff, and nroff"
 .
+Setting register
+.Ql C
+to\~1 numbers output pages consecutively,
+rather than resetting the page number to\~1 with each new
+.Nm mdoc
+document.
+.
+.
+.Pp
 By default,
 the package inhibits page breaks,
 headers,
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 2f60d26e8..88e2f073b 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -309,12 +309,15 @@
 .  \"
 .  \" If also continuously rendering, cause a page transition to a new
 .  \" mdoc(7) document.  Clear the page header trap first so it is not
-.  \" sprung with stale information.
+.  \" sprung with stale information.  Update the page number depending
+.  \" on the C (consecutive numbering) register.
 .  if !\n[doc-is-first-page-of-document] \{\
 .    ie \n[cR] .doc-end-macro
 .    el \{\
 .      ch doc-header
-.      bp 1
+.
+.      ie \n[C] .bp (\n[%] + 1) \" argument NOT redundant before page 1
+.      el       .bp 1
 .    \}
 .    nr doc-is-first-page-of-document 1
 .  \}
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 0d7dd4e04..49092108e 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -32,6 +32,28 @@
 .\"     @(#)doc-ditroff        8.1 (Berkeley) 06/08/93
 .
 .
+.nr doc-is-output-html 0
+.if '\*[.T]'html' .nr doc-is-output-html 1
+.
+.\" Use -rC1 to consecutively number pages across multiple documents.
+.\"
+.\" We must use consecutive page numbers when using PostScript to
+.\" generate HTML images; we must not reset the page number at the
+.\" beginning of each document (the 'ps4html' register is automatically
+.\" added to the command line by the pre-HTML preprocessor).
+.ie !r C \
+.  nr C 0
+.el \
+.  if !\n[C] \
+.    if \n[doc-is-output-html] \{\
+.       tm mdoc: consecutive page numbering required for HTML output
+.       nr C 1
+.    \}
+.if \n[doc-is-output-html] \
+.  nr C 1
+.if r ps4html \
+.  nr C 1
+.
 .\" Use -rCS=1 to force capitalization of section headings.
 .if !r CS .nr CS 0
 .
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index 1a1b7d4da..ca8a62270 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -32,6 +32,28 @@
 .\"     @(#)doc-nroff  8.1 (Berkeley) 06/08/93
 .
 .
+.nr doc-is-output-html 0
+.if '\*[.T]'html' .nr doc-is-output-html 1
+.
+.\" Use -rC1 to consecutively number pages across multiple documents.
+.\"
+.\" We must use consecutive page numbers when using PostScript to
+.\" generate HTML images; we must not reset the page number at the
+.\" beginning of each document (the 'ps4html' register is automatically
+.\" added to the command line by the pre-HTML preprocessor).
+.ie !r C \
+.  nr C 0
+.el \
+.  if !\n[C] \
+.    if \n[doc-is-output-html] \{\
+.       tm mdoc: consecutive page numbering required for HTML output
+.       nr C 1
+.    \}
+.if \n[doc-is-output-html] \
+.  nr C 1
+.if r ps4html \
+.  nr C 1
+.
 .\" Use -rCS=1 to force capitalization of section headings.
 .if !r CS .nr CS 0
 .



reply via email to

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