groff-commit
[Top][All Lists]
Advanced

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

[groff] 09/15: [mdoc]: Generate PDF bookmark tag for `Os` call.


From: G. Branden Robinson
Subject: [groff] 09/15: [mdoc]: Generate PDF bookmark tag for `Os` call.
Date: Sun, 17 Mar 2024 17:59:38 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e4709cf80e827b726737c5a9474901f63d2f3540
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Mar 16 11:53:14 2024 -0500

    [mdoc]: Generate PDF bookmark tag for `Os` call.
    
    * tmac/mdoc/doc-common (Os): When formatting PDF, automatically give
      each `Os` call a named PDF bookmark tag that can be used in links
      (inside the guts of the `Xr` macro).
    
    For example, this enables "inbound" links to the groff_mdoc(7) page in
    "groff-man-pages.pdf".
---
 ChangeLog            | 9 +++++++++
 tmac/mdoc/doc-common | 7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3ca83582c..a77eee43b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-16  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/mdoc/doc-common (Os): When formatting PDF, automatically
+       give each `Os` call a named PDF bookmark tag that can be used in
+       links (inside the guts of the `Xr` macro).
+
+       For example, this enables "inbound" links to the groff_mdoc(7)
+       page in "groff-man-pages.pdf".
+
 2024-03-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [pdf,man,mdoc]: Refactor a recent feature.
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 91ffcedb9..ab75f3aca 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -991,8 +991,11 @@
 .
 .  doc-set-up-titles
 .
-.  if '\*[.T]'pdf' \
-.    pdfbookmark 1 "\*[doc-page-topic](\*[doc-section])"
+.  if '\*[.T]'pdf' \{\
+.    ds doc-page-tag "\*[doc-page-topic](\*[doc-section])\"
+.    pdfbookmark -T "\*[doc-page-tag]" 1 "\*[doc-page-tag]"
+.    rm doc-page-tag
+.  \}
 .
 .  doc-header
 .  nr doc-need-titles-reset 1



reply via email to

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