[latex3-commits] [git/LaTeX3-latex3-pdfresources] develop: move hyperget to hyperref (512ca1c)
Ulrike Fischer
fischer at troubleshooting-tex.de
Sat Aug 14 18:42:41 CEST 2021
Repository : https://github.com/latex3/pdfresources
On branch : develop
Link : https://github.com/latex3/pdfresources/commit/512ca1c0dbbfc5d58f0eb445bda7d4bb17774413
>---------------------------------------------------------------
commit 512ca1c0dbbfc5d58f0eb445bda7d4bb17774413
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat Aug 14 18:42:41 2021 +0200
move hyperget to hyperref
>---------------------------------------------------------------
512ca1c0dbbfc5d58f0eb445bda7d4bb17774413
hyperref-generic.dtx | 57 +++++++++++++++++-----------------------------------
1 file changed, 18 insertions(+), 39 deletions(-)
diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 8fa873b..dd6f188 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -771,10 +771,25 @@
% it uses names like |section*.<number>| and |chapter*.<number>|.
%
% Typically the name of destination can be retrieved by setting a label, this works also
-% with unnumbered sections. But there is until now no command to get
-% the name in an expandable way so that it can be used e.g. in bookmarks.
-% This driver defines here the new command \cs|hyperget|.
+% with unnumbered sections.
+% The anchor and also the page can be retrieve in an expandable way
+% with the help of commands from the
+% \pkg{refcount} package which is loaded by hyperref. For example with the
+% following commands it is possible to use the label to create a bookmark:
%
+% \begin{verbatim}
+% \bookmark[dest=\getrefbykeydefault{label}{anchor}{Doc-Start}]{my bookmark}
+% \bookmark[dest=page.\getrefbykeydefault{label}{page}{Doc-Start}]{my bookmark}
+% \end{verbatim}
+%
+% If a \cs{HyperDestNameFilter} is defined, this must be added around the definition,
+% so actually the full code has to look like this
+% \begin{verbatim}
+% \bookmark[dest=
+% \HyperDestNameFilter{\getrefbykeydefault{label}{anchor}{Doc-Start}}]{mysection}
+% \end{verbatim}
+% To simplify this hyperref provides |\hyperget{anchor}{label}| and
+% |\hyperget{pageanchor}{label}|
%
%\section{Assorted key descriptions}\label{sec:keydesc}
%The following gives a few details to some keys that are perhaps not
@@ -928,7 +943,6 @@
%^^A %% \l_@@_dest_pdfview_tl
%^^A %% list of commands which probably will have to change
%^^A TODO: move hrefurl, hrefrun, hrefpdf into hyperref. They should also work
-%^^A with other drivers. Move hyperget into hyperref
% \end{documentation}
% \begin{implementation}
% \part{\pkg{hyperref-generic} driver implementation}
@@ -1208,41 +1222,6 @@
}
% \end{macrocode}
%
-% \begin{macro}{\hyperget}
-% This command allows to data in an expandable way.
-% Currently it is only used to retrieve a destination name from a label for
-% the use in bookmarks.
-% TODO: it should go into hyperref at some time.
-% TODO: decide if there should be an error.
-% TODO: document properly.
-% \begin{macrocode}
-\cs_new:Npn \hyperget #1 #2
- {
- \use:c { @@_get_#1:n } { #2}
- }
-% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@@_get_dest:n}
-% This retrieve a destination name from a label.
-% If the label doesn't exist it defaults to Doc-Start.
-% This should be adapted when the ref system change.
-% TODO move to hyperref
-% \begin{macrocode}
-\cs_new:Npn \@@_get_dest:n #1
- {
- \HyperDestNameFilter
- {
- \cs_if_exist:cTF {r@#1}
- {
- \tl_item:cn {r@#1}{4}
- }
- {
- Doc-Start
- }
- }
- }
-% \end{macrocode}
-% \end{macro}
% Allow non-ascii in href, and add more href versions.
% We add a few new keys:
% |urlencode| to force percent encoding (\cs{hrefurl}, \cs{href})
More information about the latex3-commits
mailing list.