• R/O
  • SSH

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

Reference Documentation: PDF Publishing with GNU Troff


Commit MetaInfo

修訂99ad4280a97e5319dfab4f5ad91aca84ae11db69 (tree)
時間2022-03-27 03:47:47
作者Keith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Improve handling of pdfbookmark names.

* tmac/pdfmark.tmac (pdfbookmark): Define...
(PDFBOOKMARK.NAME): ...this, on entry, rather than on final output.
(pdfbookmark) [-N]: Add support; suppress automatic name generation,
and use specified bookmark name instead; separate name sequencing from
bookmark cache sequencing; transfer automatic name sequencing to...
(pdf:bm.ix): ...this new auto-incrementing register, retaining...
(pdf:bm.nr): ...this for cache sequencing; make it auto-increment.

Change Summary

差異

diff -r 8dd4f5977467 -r 99ad4280a97e tmac/pdfmark.tmac
--- a/tmac/pdfmark.tmac Thu Mar 24 22:11:04 2022 +0000
+++ b/tmac/pdfmark.tmac Sat Mar 26 18:47:47 2022 +0000
@@ -2,7 +2,7 @@
22
33 pdfmark.tmac
44
5-Copyright (C) 2004-2021 Free Software Foundation, Inc.
5+Copyright (C) 2004-2022 Free Software Foundation, Inc.
66 Written by Keith Marshall (keith.d.marshall@ntlworld.com)
77
88 This file is part of groff.
@@ -647,59 +647,69 @@
647647 .\"
648648 .nr PDFOUTLINE.FOLDLEVEL 10000
649649 .\"
650-.\" The actual job of creating an outline reference
651-.\" is performed by the "pdfbookmark" macro.
650+.\" Serialization of outline entries is controlled by this pair of
651+.\" auto-incrementing numeric registers...
652+.\"
653+.nr pdf:bm.ix 0 1
654+.nr pdf:bm.nr 0 1
655+.\"
656+.\" ...while the actual job of creating an outline reference is
657+.\" performed by the "pdfbookmark" macro.
652658 .\"
653659 .de pdfbookmark
654660 .\" ------------------------------------------------------------------
655661 .\" Usage:
656-.\" .pdfbookmark [-T tag] level "Text of Outline Entry"
657-.\"
658-.\" $1 = nesting level for bookmark (1 is top level)
659-.\" $2 = text for bookmark, (in PDF viewer bookmarks list)
660-.\" $3 = suffix for PDF internal bookmark name (optional)
662+.\" .pdfbookmark [-T tag | -N name] level "Text of Outline Entry"
661663 .\" ------------------------------------------------------------------
662664 .\"
665+.\" Initialize the bookmark as both unnamed, and untagged.
666+.\"
667+.ds pdf:href-T
668+.rm pdf:href-N PDFBOOKMARK.NAME
669+.\"
670+.\" Process any specified macro option arguments, to identify any
671+.\" pre-assigned bookmark name, or desired tag assignment.
672+.\"
673+.while d pdf:href.opt\\$1 \{\
674+. pdf:href.opt\\$1 \\$@
675+. shift \\n[pdf:href.argc]
676+. \}
677+.rr pdf:href.argc
678+.\"
679+.\" If we found "--" to mark the end of the options, discard it
680+.\"
681+.if '\\$1'--' .shift
682+.\"
683+.\" Now, ensure that the bookmark IS named, either by specification
684+.\" of a pre-assigned name, or by means of an automatically generated,
685+.\" optionally tagged, and serialized name.
686+.\"
687+.ie dpdf:href-N .ds PDFBOOKMARK.NAME \\*[pdf:href-N]
688+.el .ds PDFBOOKMARK.NAME pdf:bm\\n+[pdf:bm.ix]\\*[pdf:href-T]
689+. \}
690+.\"
691+.\" We may now handle the actual generation of the outline reference.
692+.\"
663693 .ie '\\n(.z'' \{\
664-.\"
665694 .\" When we are at the top diversion level, i.e. actually emitting text
666695 .\" to the output device stream, then we compute the location of, and
667696 .\" plant this bookmark immediately.
668697 .\"
669698 . if \\n[PDFOPMODE] \{\
670699 . \"
671-. \" Make the bookmark name "untagged" by default,
672-. \" then parse any specified options, to set a "tag", if required
673-. \"
674-. ds pdf:href-T
675-. while dpdf:href.opt\\$1 \{\
676-. pdf:href.opt\\$1 \\$@
677-. shift \\n[pdf:href.argc]
678-. \}
679-. rr pdf:href.argc
680-. \"
681-. \" If we found "--" to mark the end of the options, discard it
682-. \"
683-. if '\\$1'--' .shift
684-. \"
685700 . \" Synchronise the bookmark cache
686701 . \" to the requested bookmark nesting level
687702 . \"
688703 . pdf:bm.sync \\$1
689704 . shift
690705 . \"
691-. \" Increment the bookmark serialisation index
692-. \" in order to generate a uniquely serialised bookmark name,
693-. \" ( which we return in the string "PDFBOOKMARK.NAME" ),
706+. \" Increment the bookmark cache serialisation index,
694707 . \" and insert this bookmark into the cache
695708 . \"
696709 . pdf:href.sety
697-. nr pdf:bm.nr +1
698-. ds PDFBOOKMARK.NAME pdf:bm\\n[pdf:bm.nr]\\*[pdf:href-T]
699-. ds pdf:bm\\n[pdf:bm.nr] /Dest /\\*[PDFBOOKMARK.NAME]
710+. ds pdf:bm\\n+[pdf:bm.nr] /Dest /\\*[PDFBOOKMARK.NAME]
700711 . pdfmark \\*[pdf:bm\\n[pdf:bm.nr]] /View [\\*[PDFBOOKMARK.VIEW]] /DEST
701712 . as pdf:bm\\n[pdf:bm.nr] " /Title (\\$*)
702-. pdf:href.options.clear
703713 . rr PDFPAGE.Y
704714 . \}
705715 . \}
@@ -709,10 +719,14 @@
709719 .\" then we must defer bookmark placement, until we emit the diversion.
710720 .\" (don't rely on $0 == pdfbookmark here; it may be a volatile alias).
711721 .\"
712-. nop \!.pdfbookmark \\$@
722+. nop \!.pdfbookmark -N \\*[PDFBOOKMARK.NAME] -- \\$@
713723 . \}
724+.\"
725+.\" Finally, reset the state of any optional argument indicators, before
726+.\" passing control back to the caller.
727+.\"
728+.pdf:href.options.clear
714729 ..
715-.\"
716730 .\" Macro "pdf:bm.sync" is called for each bookmark created,
717731 .\" to establish a cache entry at the appropriate nesting level.
718732 .\" It will flush ALL previous cache content, when called to
@@ -802,7 +816,6 @@
802816 .nr pdf:bm.rc \\$1
803817 .nr pdf:bm.lc -1
804818 ..
805-.nr pdf:bm.nr 0
806819 .nr pdf:bm.nl 1
807820 .nr pdf:bm.lc 0
808821 .nr pdf:bm.ic 0