[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 50/51: [mdoc]: Refactor: relocate code.
From: |
G. Branden Robinson |
Subject: |
[groff] 50/51: [mdoc]: Refactor: relocate code. |
Date: |
Sun, 11 Sep 2022 08:15:57 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 1f137a58c99b12d8479f0dcaa00e9c9fac9846ee
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 9 06:32:24 2022 -0500
[mdoc]: Refactor: relocate code.
[mdoc]: Refactor: relocate most rendering option handling to "doc.tmac"
from "doc-ditroff" and "doc-nroff", cutting down on a lot of
duplication. The `S` register retains separate handling.
* tmac/doc.tmac:
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: Do it.
Also tweak some comments. Annotate some TODO items.
---
ChangeLog | 10 ++++++++
tmac/doc.tmac | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
tmac/mdoc/doc-ditroff | 44 +-------------------------------
tmac/mdoc/doc-nroff | 52 +-------------------------------------
4 files changed, 81 insertions(+), 94 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f150883fa..a44fc7c05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [mdoc]: Refactor: relocate most rendering option handling to
+ "doc.tmac" from "doc-ditroff" and "doc-nroff", cutting down on a
+ lot of duplication. The `S` register retains separate handling.
+
+ * tmac/doc.tmac:
+ * tmac/mdoc/doc-ditroff:
+ * tmac/mdoc/doc-nroff: Do it.
+
2022-09-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/mdoc/doc-ditroff (doc-setup-page-layout): In troff mode,
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 8514e1c9c..4cc403827 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -61,6 +61,75 @@
. ab \*[doc-msg]
.\}
.
+.\" Handle most rendering options.
+.
+.nr doc-is-output-html 0
+.if '\*[.T]'html' .nr doc-is-output-html 1
+.
+.\" Use -dAD to set the adjustment mode for ordinary body text.
+.if !d AD \
+. ds AD b\"
+.
+.\" 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
+.
+.\" Use -rCT=1 to force capitalization of page titles in headers.
+.if !r CT .nr CT 0
+.
+.\" 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 \{\
+. if t .nr cR 0
+. if n .nr cR 1
+.\}
+.
+.\" If continuous rendering, tell tbl not to use keeps.
+.ie \n[cR] \
+. nr 3usekeeps 0
+.el \
+. nr 3usekeeps 1
+.
+.\" TODO: Implement HF string.
+.
+.\" \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
+.
+.\" TODO: Implement IN register.
+.
+.\" LL and LT registers are handled by the doc-setup-page-layout macro.
+.
+.\" TODO: Implement MF string.
+.
+.\" TODO: Implement P register.
+.
+.\" TODO: Implement SN register.
+.
+.\" TODO: Implement U register.
+.
+.\" TODO: Implement X register.
+.
.
.\" Load startup files.
.ie t \
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 7baeb7117..527bc1e4b 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -32,49 +32,7 @@
.\" @(#)doc-ditroff 8.1 (Berkeley) 06/08/93
.
.
-.nr doc-is-output-html 0
-.if '\*[.T]'html' .nr doc-is-output-html 1
-.
-.\" Use -dAD to set the adjustment mode for ordinary body text.
-.if !d AD \
-. ds AD b\"
-.
-.\" 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
-.
-.\" Use -rCT=1 to force capitalization of page titles in headers.
-.if !r CT .nr CT 0
-.
-.\" 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
-.
-.\" \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
-.
-.\" use -rS={11,12} to change the font size from 10pt to 11pt or 12pt.
+.\" Use -rS={11,12} to change the font size from 10pt to 11pt or 12pt.
.if !r S .nr S 10
.
.ie (\n[S] == 11) \{\
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index db3d776fe..616152c30 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -32,57 +32,7 @@
.\" @(#)doc-nroff 8.1 (Berkeley) 06/08/93
.
.
-.nr doc-is-output-html 0
-.if '\*[.T]'html' .nr doc-is-output-html 1
-.
-.\" Use -dAD to set the adjustment mode for ordinary body text.
-.if !d AD \
-. ds AD b\"
-.
-.\" 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
-.
-.\" Use -rCT=1 to force capitalization of page titles in headers.
-.if !r CT .nr CT 0
-.
-.\" 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
-.
-.\" \n[HY] is recognized for groff_man(7) compatibility, particuarly via
-.\" andoc.tmac and man(1); see \n[doc-hyphen-flags] in doc-common.
-.\" \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] \
-. nr 3usekeeps 0
-.el \
-. nr 3usekeeps 1
-.
-.\" the following switch is ignored in nroff mode
+.\" nroff devices can't change the type size; this value is notional.
.nr S 10
.
.\" Map monospaced fonts to standard styles.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 50/51: [mdoc]: Refactor: relocate code.,
G. Branden Robinson <=