[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: add keys for deactivation (2a1e641)
Ulrike Fischer
fischer at troubleshooting-tex.de
Fri Jan 29 00:09:04 CET 2021
Repository : https://github.com/latex3/pdfresources
On branch : reworking-annot
Link : https://github.com/latex3/pdfresources/commit/2a1e64116e2daca9376076f9a9f0cf62fcbda03b
>---------------------------------------------------------------
commit 2a1e64116e2daca9376076f9a9f0cf62fcbda03b
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Fri Jan 29 00:09:04 2021 +0100
add keys for deactivation
>---------------------------------------------------------------
2a1e64116e2daca9376076f9a9f0cf62fcbda03b
hyperref-generic.dtx | 88 ++++++++++++++++++++++++++++++---------------
testfiles/disable-links.pvt | 32 +++++++++++++++--
2 files changed, 89 insertions(+), 31 deletions(-)
diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index ff57e19..99243d0 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -644,6 +644,13 @@
{ pdfa-no-reset-button }
{ PDF/A:~Reset~action~is~prohibited }
% \end{macrocode}
+% pdf/A message for not allowed Named actions
+% \begin{macrocode}
+\msg_new:nnn
+ { hyp }
+ { pdfa-no-named-action }
+ { PDF/A:~Named~action~#1~is~prohibited }
+% \end{macrocode}
% A message if the destination name is empty.
% \begin{macrocode}
\msg_new:nnn
@@ -1649,7 +1656,7 @@
{#2}
}
% \end{macrocode}
-% The actually command used by hyperref is \s{@hyper at launch} which uses a delimited
+% The actually command used by hyperref is \cs{@hyper at launch} which uses a delimited
% argument, because of the color the definition is a bit convoluted.
% \begin{macrocode}
\use:x
@@ -1661,6 +1668,49 @@
}
% \end{macrocode}
%
+% \subsection{Named links (menu)}
+% \begin{macrocode}
+\pdfdict_new:n {l_hyp/annot/A/Named}
+\pdfdict_put:nnn {l_hyp/annot/A/Named}{Type}{/Action}
+\pdfdict_put:nnn {l_hyp/annot/A/Named}{S}{/Named}
+
+\RenewDocumentCommand \Acrobatmenu { m m }
+ {
+ \bool_if:NTF \l_@@_annot_Named_bool
+ {
+ \group_begin:
+ \pdfmeta_if_named_action_allowed:nTF {#1}
+ {
+ \mode_leave_vertical:
+ \pdfdict_put:nnx {l_hyp/annot/A/Named}{N}
+ {\pdf_text_convert:nn{name-print}{#1}}
+ \tl_if_empty:NF \Hy at href@nextactionraw
+ {
+ \str_remove_once:Nn \Hy at href@nextactionraw {/Next}
+ \pdfdict_put:nno{l_hyp/annot/A/Next}{Next}{\Hy at href@nextactionraw}
+ }
+ \pdfannot_link:nxn { Named }
+ {
+ /A
+ <<
+ \pdfdict_use:n { l_hyp/annot/A/Named }
+ >>
+ }
+ {
+ #2
+ \Hy at xspace@end
+ \Hy at VerboseLinkStop
+ }
+ }
+ {
+ \msg_warning:nnn { hyp } { pdfa-no-named-action }{#1}
+ #2
+ }
+ \group_end:
+ }
+ {#2}
+ }
+% \end{macrocode}
% \begin{macrocode}
\pdfannot_link_margin:n { 1pt }
@@ -1898,6 +1948,14 @@
}
}
+\prop_map_inline:Nn \c_@@_map_hyp_annot_prop
+ {
+ \keys_define:nn { hyp / setup }
+ {
+ #1 .bool_set:c = {l_@@_annot_#2_bool}
+ }
+ }
+
\keys_define:nn { hyp / setup }
{
,plainpages .choice:
@@ -3233,34 +3291,6 @@
}
%%% UF removed setpagesize code, should be done by kernel/graphicx
-%!! do we need a action dict type??
-\RenewDocumentCommand \Acrobatmenu { m m }
- {
- \pdfmeta_if_named_action_allowed:nTF {#1}
- {
- \mode_leave_vertical:
- \pdfannot_link:nnn { Named }
- {
- /A
- <<
- /S/Named
- /N\pdf_text_convert:nn{name-print}{#1}
- \Hy at href@nextactionraw
- >>
- }
- {
- \Hy at colorlink\@menucolor#2
- \Hy at xspace@end
- \Hy at endcolorlink
- \Hy at VerboseLinkStop
- }
- }
- {
- % named action not allowed ...
- % error??
- #2
- }
- }
%%%%%%%%%%%%%% Temporary stuff
diff --git a/testfiles/disable-links.pvt b/testfiles/disable-links.pvt
index 87655f5..be0fd60 100644
--- a/testfiles/disable-links.pvt
+++ b/testfiles/disable-links.pvt
@@ -1,7 +1,14 @@
+\input{regression-test}
+\RequirePackage{pdfmanagement}
+\DeclareDocumentMetadata
+ {
+ uncompress,
+ standard=A-3b
+ }
\documentclass{article}
\usepackage[colorlinks]{hyperref}
-%\hypersetup{draft}
\begin{document}
+
\ExplSyntaxOn
\bool_set_false:N \l__hyp_annot_GoTo_bool
\ExplSyntaxOff
@@ -17,12 +24,33 @@
\ref{x},
+\url{https://github.com/latex3/luaotfload/issues/154}
+
+\href{test-pdfresources.pdf}{test file}
+
+\href{run:tests-nopdf.toc}{blub}
+
+\Acrobatmenu{Find}{Find}
+
+\Acrobatmenu{FirstPage}{FirstPage}
+
\ExplSyntaxOn
\bool_set_false:N \l__hyp_annot_GoTo_bool
+\bool_set_false:N \l__hyp_annot_URI_bool
+\bool_set_false:N \l__hyp_annot_GoToR_bool
+\bool_set_false:N \l__hyp_annot_Launch_bool
+\bool_set_false:N \l__hyp_annot_Named_bool
\ExplSyntaxOff
\ref{x}
-%\url{https://github.com/latex3/luaotfload/issues/154}
+\url{https://github.com/latex3/luaotfload/issues/154}
+
+\href{test-pdfresources.pdf}{test file}
+
+\href{run:tests-nopdf.toc}{blub}
+
+\Acrobatmenu{Find}{Find}
+\Acrobatmenu{FirstPage}{FirstPage}
\end{document}
More information about the latex3-commits
mailing list.