groff-commit
[Top][All Lists]
Advanced

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

[groff] 28/40: [mdoc]: Support `P` register.


From: G. Branden Robinson
Subject: [groff] 28/40: [mdoc]: Support `P` register.
Date: Mon, 12 Dec 2022 19:28:06 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 17477b26f5881117dd3f2c4df8db9420b2f3e9ae
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Dec 11 15:31:31 2022 -0600

    [mdoc]: Support `P` register.
    
    * tmac/doc.tmac (initialization): Add logic supporting `P` register just
      as our man(7) implementation does.
    
    * tmac/groff_mdoc.7.man (Formatting with groff, troff, and nroff):
      Document it.
    
    * NEWS: Update item.
    
    Fixes part of <https://savannah.gnu.org/bugs/?63046>.
    
    One test fails at this commit.
    
    FAIL: tmac/tests/andoc_P-register-works.sh
---
 ChangeLog             | 12 ++++++++++++
 NEWS                  |  4 ++--
 tmac/doc.tmac         | 24 +++++++++++++++++++++++-
 tmac/groff_mdoc.7.man | 11 +++++++++--
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 90c0204ae..11ff26ef9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-12-11  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [doc]: Support `P` register.
+
+       * tmac/doc.tmac (initialization): Add logic supporting `P`
+       register just as our man(7) implementation does.
+       * tmac/groff_mdoc.7.man (Formatting with groff, troff, and
+       nroff): Document it.
+       * NEWS: Update item.
+
+       Fixes part of <https://savannah.gnu.org/bugs/?63046>.
+
 2022-12-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tests]: Add unit tests for man/mdoc `P` register.
diff --git a/NEWS b/NEWS
index d1bcb6bfb..fddc024bc 100644
--- a/NEWS
+++ b/NEWS
@@ -320,8 +320,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 `C`, `HY`, `IN`, and `SN`
-  registers as the an (man) package does.
+o The doc (mdoc) macro package now honors the `C`, `HY`, `IN`, `P`, and
+  `SN` registers as the an (man) package does.
 
 o The doc (mdoc) macro package now renders man page (sub)section cross
   references cited with the `Sx` macro by quoting them instead of
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index c72b7d22b..4da964da1 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -129,7 +129,29 @@
 .
 .\" TODO: Implement MF string.
 .
-.\" TODO: Implement P register.
+.\" starting page number
+.\"
+.\" Unlike most of these parameters, we do not set a default for P;
+.\" troff supplies a default starting page number (1).  When rendering
+.\" for the HTML output device, page numbers are concealed and used for
+.\" internal purposes like image embedding.  Page numbers are not
+.\" rendered at all in continuous rendering mode.
+.if r P \{\
+.  if \n[doc-is-output-html] \
+.    if !(\n[P] = 1) \
+.      ds doc-msg in HTML output\"
+.  if \n[cR] \
+.    ds doc-msg when continuously rendering
+.\}
+.if d doc-msg \{\
+.  tm mdoc: ignoring starting page number \*[doc-msg]
+.  rr P
+.  rm doc-msg
+.\}
+.
+.if !r ps4html \
+.  if r P \
+.    pn 0\n[P]
 .
 .\" Use -rSN=<xxx> to set the subsection heading indentation amount.
 .if !r SN .nr SN 3n
diff --git a/tmac/groff_mdoc.7.man b/tmac/groff_mdoc.7.man
index 011f0d56d..54adb5d0e 100644
--- a/tmac/groff_mdoc.7.man
+++ b/tmac/groff_mdoc.7.man
@@ -4935,6 +4935,14 @@ both registers default to 78n for terminal devices and 
6.5i otherwise.
 .
 .
 .Pp
+Setting the
+.Ql P
+register starts enumeration of pages at its value.
+.
+The default is\~1.
+.
+.
+.Pp
 Normally,
 automatic hyphenation is enabled using a mode appropriate to the
 .Xr groff
@@ -4954,8 +4962,7 @@ The
 .Ql HF
 string
 and
-.Ql FT ,
-.Ql P ,
+.Ql FT
 and
 .Ql X
 registers



reply via email to

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