summaryrefslogtreecommitdiff
path: root/tmac/mdoc
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2022-11-05 00:07:08 -0500
committerG. Branden Robinson <g.branden.robinson@gmail.com>2022-11-05 23:17:35 -0500
commit9e57840a4dfa24b183300f2c5cfc4464ebe1bfa4 (patch)
tree3eabcb18acce85840da37cd9a8bc473b5f564115 /tmac/mdoc
parentf13f7380cfee7d917e22fb50c198dd0d7fdc1b2c (diff)
downloadgroff-git-9e57840a4dfa24b183300f2c5cfc4464ebe1bfa4.tar.gz
[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.
Diffstat (limited to 'tmac/mdoc')
-rw-r--r--tmac/mdoc/doc-common20
1 files changed, 17 insertions, 3 deletions
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]