[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 46/49: [mdoc]: Add internal register doc-in-name-section.
From: |
G. Branden Robinson |
Subject: |
[groff] 46/49: [mdoc]: Add internal register doc-in-name-section. |
Date: |
Sun, 6 Nov 2022 00:37:24 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 9e57840a4dfa24b183300f2c5cfc4464ebe1bfa4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 5 00:07:08 2022 -0500
[mdoc]: Add internal register doc-in-name-section.
* tmac/mdoc/doc-common: Add internal register `doc-in-name-section` to
keep track of whether a macro is called within the "Name" section of
the document, to prepare a means of fixing a long-standing bug with
`Nm`.
(Sh): Canonicalize capitalization of section heading sooner. Set or
clear `doc-in-name-section` based on result.
(Rd): Add new register to dump.
* tmac/doc.tmac (doc-save-global-vars, doc-restore-global-vars): Handle
new register.
---
ChangeLog | 12 ++++++++++++
tmac/doc.tmac | 2 ++
tmac/mdoc/doc-common | 20 +++++++++++++++++---
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0381c766c..e59815725 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-11-05 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * tmac/mdoc/doc-common: Add internal register
+ `doc-in-name-section` to keep track of whether a macro is called
+ within the "Name" section of the document, to prepare a means of
+ fixing a long-standing bug with `Nm`.
+ (Sh): Canonicalize capitalization of section heading sooner.
+ Set or clear `doc-in-name-section` based on result.
+ (Rd): Add new register to dump.
+ * tmac/doc.tmac (doc-save-global-vars, doc-restore-global-vars):
+ Handle new register.
+
2022-11-04 G. Branden Robinson <g.branden.robinson@gmail.com>
[mdoc]: Use font CR, not CB, for `Cm` ("command modifier") and
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index b08fe5c63..3ee5802da 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -3539,6 +3539,7 @@
. \}
.
. nr doc-curr-font-saved \n[doc-curr-font]
+. nr doc-in-name-section-saved \n[doc-in-name-section]
. nr doc-in-synopsis-section-saved \n[doc-in-synopsis-section]
. nr doc-in-library-section-saved \n[doc-in-library-section]
. nr doc-indent-synopsis-saved \n[doc-indent-synopsis]
@@ -3679,6 +3680,7 @@
. \}
.
. nr doc-curr-font \n[doc-curr-font-saved]
+. nr doc-in-name-section \n[doc-in-name-section-saved]
. nr doc-in-synopsis-section \n[doc-in-synopsis-section-saved]
. nr doc-in-library-section \n[doc-in-library-section-saved]
. nr doc-indent-synopsis \n[doc-indent-synopsis-saved]
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 15cc5b1eb..db2a28871 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -1222,6 +1222,12 @@
.ec
.
.
+.\" NS doc-in-name-section global register (bool)
+.\" NS whether we are in the 'name' section
+.
+.nr doc-in-name-section 0
+.
+.
.\" NS doc-in-synopsis-section global register (bool)
.\" NS whether we are in the 'synopsis' section
.
@@ -1313,6 +1319,7 @@
.\" NS doc-in-authors-section
.\" NS doc-in-files-section
.\" NS doc-in-library-section
+.\" NS doc-in-name-section
.\" NS doc-in-see-also-section
.\" NS doc-in-synopsis-section
.\" NS doc-indent-synopsis
@@ -1340,6 +1347,14 @@
. \" Tell doc-print-recursive whether to force capitalization.
. nr doc-do-capitalize \n[CS]
.
+. \" Normalize capitalization of section heading.
+. doc-prepare-section-heading \$*
+.
+. ie "\*[doc-sec-head]"\*[doc-section-name]" \
+. nr doc-in-name-section 1
+. el \
+. nr doc-in-name-section 0
+.
. ie \n[doc-arg-count] \{\
. \" we only allow 'Sh' within 'Sh'; it will change the font back to
. \" 'doc-Sh-font'
@@ -1369,14 +1384,12 @@
.
. ad \*[AD]
.
-. \" this resolves, e.g., '.Sh "SEE ALSO"'
-. doc-prepare-section-heading \$*
-.
. ie "\*[doc-sec-head]"\*[doc-section-name]" \{\
. doc-set-up-titles
. in 0
. \}
. el \{\
+. nr doc-in-name-section 0
. nr doc-in-synopsis-section 0
. nr doc-in-library-section 0
. nr doc-in-see-also-section 0
@@ -1658,6 +1671,7 @@
. tm doc-operating-system == '\*[doc-operating-system]'
. tm doc-date-string == '\*[doc-date-string]'
. tm doc-display-vertical == \n[doc-display-vertical]
+. tm doc-in-name-section == \n[doc-in-name-section]
. tm doc-in-synopsis-section == \n[doc-in-synopsis-section]
. tm doc-in-library-section == \n[doc-in-library-section]
. tm doc-in-see-also-section == \n[doc-in-see-also-section]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 46/49: [mdoc]: Add internal register doc-in-name-section.,
G. Branden Robinson <=