groff-commit
[Top][All Lists]
Advanced

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

[groff] 28/51: [mdoc]: Refactor.


From: G. Branden Robinson
Subject: [groff] 28/51: [mdoc]: Refactor.
Date: Sun, 11 Sep 2022 08:15:53 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 534502613d7578ea9f1fdfed215b572e2c60f647
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Sep 7 00:00:28 2022 -0500

    [mdoc]: Refactor.
    
    Rename strings and macro for clarity.  These things don't only affect
    headers.
    - doc-header-string ->       doc-pageref
    - doc-header-string-saved -> doc-pageref-saved
    - doc-setup-header ->        doc-set-up-titles
    
    * tmac/doc.tmac:
    * tmac/mdoc/doc-common: Do it.
---
 ChangeLog            | 11 +++++++++++
 tmac/doc.tmac        |  4 ++--
 tmac/mdoc/doc-common | 42 +++++++++++++++++++++++-------------------
 3 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e491039fc..a4060d2cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mdoc]: Refactor.  Rename strings and macro for clarity.  These
+       things don't only affect headers.
+       - doc-header-string ->       doc-pageref
+       - doc-header-string-saved -> doc-pageref-saved
+       - doc-setup-header ->        doc-set-up-titles
+
+       * tmac/doc.tmac:
+       * tmac/mdoc/doc-common: Do it.
+
 2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Refactor.  There is no difference in
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 8a84fb0c2..8d2006be9 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -3575,7 +3575,7 @@
 .  ds doc-date-string-saved "\*[doc-date-string]
 .  nr doc-header-space-saved \n[doc-header-space]
 .  nr doc-display-vertical-saved \n[doc-display-vertical]
-.  ds doc-header-string-saved "\*[doc-header-string]
+.  ds doc-pageref-saved "\*[doc-pageref]
 .  nr doc-in-see-also-section-saved \n[doc-in-see-also-section]
 .  nr doc-in-files-section-saved \n[doc-in-files-section]
 .  nr doc-in-authors-section-saved \n[doc-in-authors-section]
@@ -3718,7 +3718,7 @@
 .  ds doc-date-string "\*[doc-date-string-saved]
 .  nr doc-header-space \n[doc-header-space-saved]
 .  nr doc-display-vertical \n[doc-display-vertical-saved]
-.  ds doc-header-string "\*[doc-header-string-saved]
+.  ds doc-pageref "\*[doc-pageref-saved]
 .  nr doc-in-see-also-section \n[doc-in-see-also-section-saved]
 .  nr doc-in-files-section \n[doc-in-files-section-saved]
 .  nr doc-in-authors-section \n[doc-in-authors-section-saved]
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 148cd54c6..99f3a12ac 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -212,25 +212,29 @@
 .ds doc-section \" empty
 .
 .
-.\" NS doc-header-string global string
-.\" NS   the final string used for the manual page header
+.\" NS doc-pageref global string
+.\" NS   the man page identifier formatted for cross-reference
 .
-.ds doc-header-string
+.ds doc-pageref \" empty
 .
 .
-.\" NS doc-setup-header macro
+.\" NS doc-set-up-titles macro
 .\" NS   install and initialize header and footer support
 .\" NS
 .\" NS modifies:
-.\" NS   doc-header-string
+.\" NS   doc-pageref
 .\"
 .\" TODO: Support man(7)'s `FT` register.
+.\" TODO: support man(7)'s `MF` string.  Embed the font selection escape
+.\"   sequences in `doc-pageref` here; `doc-header` and `doc-footer` can
+.\"   treat it atomically and strings are already defined for the
+.\"   separate components; see below.
 .
 .eo
-.de doc-setup-header
-.  ds doc-header-string "\*[doc-document-title]
+.de doc-set-up-titles
+.  ds doc-pageref "\*[doc-document-title]
 .  if !"\*[doc-section]"" \
-.    as doc-header-string \|(\*[doc-section])
+.    as doc-pageref \|(\*[doc-section])
 .
 .  br
 .
@@ -417,7 +421,7 @@
 .    if "\*[doc-volume]"LOCAL" \
 .      ds doc-volume \$3
 .
-.  doc-setup-header
+.  doc-set-up-titles
 .
 .  if \n[nl] \
 .    bp
@@ -974,23 +978,23 @@
 .    \" Re-use doc-header-space between page top and header.
 .    sp \n[doc-header-space]u
 .  \}
-.  nr doc-reg-dh \w'\*[doc-caption-font]\*[doc-header-string]\f[]'
+.  nr doc-reg-dh \w'\*[doc-caption-font]\*[doc-pageref]\f[]'
 .  nr doc-reg-dh1 \w'\*[doc-caption-font2]\*[doc-volume]\f[]'
 .  if (\n[doc-reg-dh] + \n[doc-reg-dh1] + \n[doc-reg-dh] >= \n[.lt]) \{\
 .    while (\n[doc-reg-dh] + \n[doc-reg-dh1] + \n[doc-reg-dh] >= \n[.lt]) \{\
-.      length doc-hs-len-prev \*[doc-header-string]
-.      substring doc-header-string 0 -2
-.      length doc-hs-len \*[doc-header-string]
-.      nr doc-reg-dh \w'\*[doc-caption-font]\*[doc-header-string]\|.\|.\|.\f[]'
+.      length doc-hs-len-prev \*[doc-pageref]
+.      substring doc-pageref 0 -2
+.      length doc-hs-len \*[doc-pageref]
+.      nr doc-reg-dh \w'\*[doc-caption-font]\*[doc-pageref]\|.\|.\|.\f[]'
 .      \" If header string didn't actually get shorter, stop trying.
 .      if (\n[doc-hs-len-prev] <= \n[doc-hs-len]) \
 .        break
 .    \}
 .    rr doc-hs-len
 .    rr doc-hs-len-prev
-.    as doc-header-string "\|.\|.\|.
+.    as doc-pageref "\|.\|.\|.
 .  \}
-.  tl 
'\*[doc-caption-font]\*[doc-header-string]\f[]'\*[doc-caption-font2]\*[doc-volume]\f[]'\*[doc-caption-font]\*[doc-header-string]\f[]'
+.  tl 
'\*[doc-caption-font]\*[doc-pageref]\f[]'\*[doc-caption-font2]\*[doc-volume]\f[]'\*[doc-caption-font]\*[doc-pageref]\f[]'
 .  ie !\n[cR] \
 .    sp \n[doc-header-space]u
 .  el \{\
@@ -1026,7 +1030,7 @@
 .  \}
 .  el \{\
 .    ie \n[cR] \
-.      tl 
'\*[doc-caption-font]\*[doc-operating-system]\f[]'\*[doc-caption-font2]\*[doc-date-string]\f[]'\*[doc-header-string]'
+.      tl 
'\*[doc-caption-font]\*[doc-operating-system]\f[]'\*[doc-caption-font2]\*[doc-date-string]\f[]'\*[doc-pageref]'
 .    el \
 .      tl 
'\*[doc-caption-font]\*[doc-operating-system]\f[]'\*[doc-caption-font2]\*[doc-date-string]\f[]'%'
 .  \}
@@ -1328,7 +1332,7 @@
 .    doc-prepare-section-heading \$*
 .
 .    ie "\*[doc-sec-head]"\*[doc-section-name]" \{\
-.      doc-setup-header
+.      doc-set-up-titles
 .      in 0
 .    \}
 .    el \{\
@@ -1613,7 +1617,7 @@
 .  tm doc-date-string == '\*[doc-date-string]'
 .  tm doc-header-space == \n[doc-header-space]
 .  tm doc-display-vertical == \n[doc-display-vertical]
-.  tm doc-header-string == '\*[doc-header-string]'
+.  tm doc-pageref == '\*[doc-pageref]'
 .  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]



reply via email to

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