summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx')
-rw-r--r--Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx418
1 files changed, 341 insertions, 77 deletions
diff --git a/Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx b/Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx
index ee7c99874ae..8c60439dd31 100644
--- a/Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx
+++ b/Master/texmf-dist/source/latex/pdfmanagement-testphase/hyperref-generic.dtx
@@ -86,7 +86,7 @@
% }^^A
% }
%
-% \date{Version 0.95b, released 2021-03-07}
+% \date{Version 0.95c, released 2021-03-17}
%
% \maketitle
% \begin{documentation}
@@ -172,7 +172,7 @@
% The current handling of the metadata is problematic:
% \begin{itemize}
% \item External package like \pkg{hyperxmp} wants to access them too and for
-% this had to patch an number of internal hyperref commands---which is a problem
+% this had to patch an number of internal \pkg{hyperref} commands---which is a problem
% if the internal commands change (as happens with this new driver)
% \item \pkg {hyperref} (and also \pkg{hyperxmp})
% tries to deduce some datas from document commands like
@@ -212,7 +212,7 @@
%
% \end{itemize}
% \section{Dates}
-% \pkg{hyperref has a few keys to set dates}. They typically expect the date
+% \pkg{hyperref} has a few keys to set dates. They typically expect the date
% in \enquote{PDF} format: |D:YYYYMMDDhhmmss+01'00'|.
%
% One should be aware that \pkg{hyperxmp} will sometimes
@@ -243,6 +243,115 @@
% So if the PDF page size is wrong: load one of the other packages setting it
% e.g. the \pkg{color} or the \pkg{graphicx} package.
%
+% \section{Commands to create \enquote{external} references}
+% \pkg{hyperref} has three commands related to external references like
+% URL and file: \cs{url},
+% \cs{nolinkurl} and \cs{href}. The first two take one argument,
+% while the last has two: the url and some free text.
+%
+%
+% \cs{url} and \cs{href} create link annotations. \cs{url} creates always an URI
+% type, \cs{href} creates URI, GoToR and Launch
+% depending on the structure of the argument.
+%
+% \cs{href} has to create a (in the PDF) valid url or file name from its first argument.
+% \cs{url} has to create a (in the PDF) valid url from its only argument and has also to print
+% this argument as url. \cs{nolinkurl} only prints the url.
+%
+% For the printing \cs{url} and \cs{nolinkurl} rely on the url package and its \cs{Url} command.
+%
+% (Expandable) commands are expanded and special chars can also be input by commands but
+% beside this no conversion is done: for all input \pkg{hyperref} basically assumes that
+% the input is already a valid percent encoded url or a valid file name. \pkg{hyperref} also
+% doesn't extend or add protocols.
+%
+% As nowadays everyone is used to copy and paste links with all sorts of unicode into a browser and
+% they work the \pkg{hyperref} input is clearly rather restricted.
+%
+% So the new driver tries to extend the input and print options. Both \cs{href} and \cs{url}
+% can now be told to accept non-ascii url's and to convert them internally to
+% percent encoding. It is possible to define a standard protocol and so to avoid to
+% have to type it all the time.
+%
+% But extending the \emph{print} options for \cs{url} and \cs{nolinkurl} while still
+% using the url-package is hard to impossible in pdf\LaTeX{} due to the way the url package works.
+% Some chars can be added with the help of \cs{UrlSpecial} (at the cost of warnings)
+% but it doesn't work for every input and documenting and explaining all the edge cases is no joy.
+% So instead the new driver offers here the option to use different commands to format
+% the printed output. It must be noted that this disable the special \enquote{hyphenation} method of
+% url's.
+%
+%
+% \subsection{Special problem: links to files}
+%
+% When a file is linked with \cs{href} than normally it is added as URI link. The exceptions are PDF's:
+% for them PDF has the special type GoToR which allows also to link to a destination or a special page.
+%
+% After a number of tests with various PDF viewer established that non-ascii files names don't
+% work at all with a simple file name specification GoToR links now use a full
+% filespec dictionary. This works better, but still no every PDF viewer support this correctly.
+% on various system.
+%
+% The following can be used to test viewers. It assumes that a \texttt{test.pdf},
+% a \texttt{grüßpdf.pdf} and a \texttt{grüße.txt} are in the current folder.
+%
+% \hrefpdf{test.pdf}{test-ascii}
+%
+% \hrefpdf{grüßpdf.pdf}{test grüßpdf.pdf}
+%
+% \hrefurl[urlencode]{grüße.txt}{test grüße.txt}
+%
+%
+% \subsection{Splits}
+%
+% \cs{href} tries to be clever and to detect from the argument
+% if a url or a file link or a launch command should be created.
+%
+% The rules are not trivial, and they make the code complicated.
+% This detection also makes it more difficult to handle special cases
+% like non-ascii input for the link types.
+%
+% For this reason three new commands have been create:
+%
+% \begin{itemize}
+% \item \cs{hrefurl} for standard urls (and non-pdf files)
+% \item \cs{hrefpdf} for references to pdf files
+% \item \cs{hrefrun} for launch links
+% \end{itemize}
+%
+% The new commands don't use prefixes like \cs{href}.
+% Their argument should be the real content.
+%
+% \subsection{Options}
+% All \cs{href} commands and \cs{url} have an option argument for keyval syntax.
+% It accepts the following keys. Not all keys make sense for all keys, but they don't
+% error, they are silently ignored.
+%
+% \begin{tabular}{llp{6cm}}
+% key & applicable commands & note\\\hline
+% urlencode & \cs{hrefurl} & if set the code will convert the argument to percent encoding. This allows non-ascii input.\\
+% protocol & \cs{hrefurl}, \cs{url} & This sets a prefix/protocol that is added to the url, see below. \\
+% format & \cs{url} & a command used to format the printed text. It replaces the standard \cs{Url}. This can improve non-ascii
+% typesetting at the cost of losing the special line breaking.\\
+% destination & \cs{href}, \cs{hrefpdf} & A destination name in the PDF\\
+% page & \cs{href}, \cs{hrefpdf} & destination page, default: 1\\
+% pdfremotestartview &\cs{href}, \cs{hrefpdf} & start view, default: Fit\\
+% ismap & \cs{href}, \cs{hrefurl} & see PDF reference\\
+% afrelationship & \cs{href}, \cs{hrefpdf} & Changes the /AFRelationship key of the filespec dictionary. The value should be a PDF name without the starting slash.\\
+% run-parameter & \cs{hreflaunch} & run parameter (see the PDF reference)\\
+% nextactionraw & various & puts a /Next entry in the action dictionary (see the PDF reference)\\
+% \end{tabular}
+%
+%
+% The first four keys can be set also in \cs{hypersetup} for all following commands in
+% the current group through the keys
+% \texttt{href/urlencode}, \texttt{href/protocol}, \texttt{href/destination}, \texttt{href/format}.
+%
+% It is possible to define own url commands with specific options e.g. with
+%
+% \begin{verbatim}
+% \NewDocumentCommand\myurl{O{}}{\url[protocol=https://,format=\textsc,#1]}
+% \end{verbatim}
%
% \section{Link decorations: border, color, OCG-color, \ldots}
% Some main changes are
@@ -329,7 +438,7 @@
%
% The new key |colorscheme| allows to switch the colors (both for text and borders)
% with a key word. It takes one of the values
-% |orginal| (the colors as hyperref uses normally), |phelype|, |daleif|,
+% |orginal| (the colors as \pkg{hyperref} uses normally), |phelype|, |daleif|,
% |szabolcsA|, |szabolcsB|, |tivv|, |julian|, |henryford|.
%
% The names refer to the authors in answers and comments in
@@ -396,7 +505,7 @@
% to pdftex and luatex driver, but a change for the xetex and dvips driver.
% The (undocumentated) command \cs{setpdflinkmargin} does nothing.
% Use either the key |pdflinkmargin| or \cs{pdfannot_link_margin:n} to change the margin.
-% See also the description in section~\ref{sec:keydesc} and in the hyperref manual.
+% See also the description in section~\ref{sec:keydesc} and in the \pkg{hyperref} manual.
% \end{description}
%
% \section{PDF strings}
@@ -483,7 +592,7 @@
% in \cs{hypersetup} and disable links and anchors completely.
% The new driver passes the options also to the \pkg{bookmark} package if
% \pkg{bookmark} hasn't been loaded yet as bookmarks can't work properly if
-% the anchors from hyperref are missing.
+% the anchors from \pkg{hyperref} are missing.
%
% \DescribeHypkey{link}%
% \DescribeHypkey{url}%
@@ -812,8 +921,7 @@
%<@@=hyp>
% \end{macrocode}
% \begin{macrocode}
-\ProvidesFile{hgeneric-testphase.def}
- [2021/02/22 v0.95b %
+\ProvidesFile{hgeneric-testphase.def}[2021-03-17 v0.95c %
generic Hyperref driver for the LaTeX PDF management testphase bundle]
\RequirePackage{etoolbox} %why?
@@ -989,9 +1097,10 @@
% \section{Variants}
% \begin{macrocode}
\cs_generate_variant:Nn\pdf_destination:nn {nf}
+\cs_generate_variant:Nn\pdf_object_ref:n {e}
% \end{macrocode}
% \section{Overwriting/providing commands from hyperref}
-% hyperref checks driver version, we need to suppress this during the development
+% \pkg{hyperref} checks driver version, we need to suppress this during the development
% \begin{macrocode}
\chardef\Hy@VersionChecked=1 %don't check the version!
% \end{macrocode}
@@ -1066,7 +1175,165 @@
}
}
% \end{macrocode}
+% 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})
+% |protocol | to add a protocol (\cs{hrefurl},
+% \cs{href} doesn't work here as it needs the colon for the split and the guessing.)
+% |destination| to add a destination (\cs{hrefpdf})
%
+% \begin{macrocode}
+
+\bool_new:N \l_@@_href_url_encode_bool
+\bool_new:N \l_@@_href_url_ismap_bool
+\tl_new:N \l_@@_href_url_protocol_tl
+\tl_new:N \l_@@_href_pdf_destination_tl
+\tl_new:N \l_@@_href_pdf_page_tl
+\tl_new:N \l_@@_href_run_parameter_tl
+\cs_new_protected:Npn \@@_href_url_format {\begingroup\Url}
+
+
+\keys_define:nn { hyp / href }
+ {
+ ,urlencode .bool_set:N = \l_@@_href_url_encode_bool
+ ,format .code:n = { \cs_set_eq:NN \@@_href_url_format #1 },
+ ,protocol .tl_set:N = \l_@@_href_url_protocol_tl
+ ,destination .tl_set:N = \l_@@_href_pdf_destination_tl
+ ,pdfremotestartview .code:n =
+ {
+ \keys_set:nn { hyp / setup }
+ { pdfremotestartview = #1 }
+ }
+ ,page .code:n =
+ {
+ \tl_set:Nn \l_@@_href_pdf_page_tl {#1}
+ \tl_set:Nn \Hy@href@page {#1}
+ }
+ ,ismap .bool_set:N = \l_@@_href_url_ismap_bool
+ ,run-parameter .tl_set:N = \l_@@_href_run_parameter_tl
+ ,nextactionraw .code:n =
+ { %perhaps some safety match later, see hyperref code
+ \tl_if_empty:nTF
+ {
+ \pdfdict_remove:nn{l_hyp/annot/A}{Next}
+ }
+ {
+ \pdfdict_put:nnn{l_hyp/annot/A}{Next}{#1}
+ \tl_set:Nn \Hy@href@nextactionraw {/Next~#1}
+ \keys_set:nn {hyp / setup }{ pdfnewwindow = true}
+ }
+ }
+ ,afrelationship .code:n =
+ {
+ \pdfdict_put:nnx
+ { l_pdffile/Filespec}{AFRelationship}{ \pdf_name_from_unicode_e:n {#1}}
+ }
+
+ }
+
+\keys_define:nn { hyp / setup }
+ {
+ ,href / urlencode .bool_set:N = \l_@@_href_url_encode_bool
+ ,href / urlencode .default:n = {true}
+ ,href / urlencode .initial:n = {false}
+ ,href / protocol .tl_set:N = \l_@@_href_url_protocol_tl
+ ,href / destination .tl_set:N = \l_@@_href_pdf_destination_tl
+ ,href / format .code:n = { \cs_set_eq:NN \@@_href_url_format #1 }
+ }
+
+
+
+\DeclareRobustCommand*{\href}[1][]{%
+ \begingroup
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \bool_if:NTF \l_@@_href_url_encode_bool
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
+ }
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
+ }
+ \@ifnextchar\bgroup\Hy@href{\hyper@normalise\href@}%
+}
+
+
+\DeclareRobustCommand*{\hrefurl}[1][]{
+ \group_begin:
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \bool_if:NTF \l_@@_href_url_encode_bool
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
+ }
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
+ }
+ \hyper@normalise\@@_href_url_aux:nn}
+
+\cs_new_protected:Npn \@@_href_url_aux:nn #1 #2
+ {
+ \exp_args:Nno\hyper@linkurl{#2}{\l_@@_href_url_protocol_tl#1}
+ \group_end:
+ }
+
+
+\DeclareRobustCommand*{\hrefpdf}[1][]
+ {
+ \begingroup
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \hyper@normalise\@@_href_pdf_aux:nn
+ }
+
+\cs_new_protected:Npn \@@_href_pdf_aux:nn #1 #2
+ {
+ \exp_args:Nnno\hyper@linkfile{#2}{#1}{\l_@@_href_pdf_destination_tl}\endgroup
+ }
+
+\DeclareRobustCommand*{\hrefrun}[1][]
+ {
+ \group_begin:
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \hyper@normalise\@@_href_run_aux:nn
+ }
+
+\cs_new_protected:Npn \@@_href_run_aux:nn #1 #2
+ {
+ \exp_args:Nnno\hyper@linklaunch{#2}{#1}{\l_@@_href_run_parameter_tl}
+ \group_end:
+ }
+
+\DeclareRobustCommand*{\url}[1][]
+ {
+ \group_begin:
+ \keys_set:nn {hyp / href } {#1}
+ \let\protect \@unexpandable@protect
+ \bool_if:NTF \l_@@_href_url_encode_bool
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
+ }
+ {
+ \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
+ }
+ \hyper@normalise\@@_href_url_aux:n
+ }
+
+\cs_new_protected:Npn \@@_href_url_aux:n #1
+ {
+ \exp_args:Nno
+ \hyper@linkurl{\@@_href_url_format {#1}}
+ {\l_@@_href_url_protocol_tl#1}
+ \group_end:
+ }
+
+
+\NewExpandableDocumentCommand\@@_secondoftwowithopt:wnn {omm}{#3}
+\pdfstringdefDisableCommands{\let\hrefurl\@@_secondoftwowithopt:wnn}
+\pdfstringdefDisableCommands{\let\hrefpdf\@@_secondoftwowithopt:wnn}
+\pdfstringdefDisableCommands{\let\hrefrun\@@_secondoftwowithopt:wnn}
+% \end{macrocode}
% \section{Compability commands}
% \subsection{Metadata}
% A number of values should be accessible from other packages. Until now
@@ -1591,7 +1858,7 @@
% \end{macrocode}
% \end{macro}
% \section {Core Hyperref Commands}
-% Every hyperref has to define eight core command:
+% Every \pkg{hyperref} has to define eight core command:
% \begin{verbatim}
% \hyper@anchor
% \hyper@anchorstart
@@ -1719,7 +1986,7 @@
}
% \end{macrocode}
%
-% Now the three hyperref commands.
+% Now the three \pkg{hyperref} commands.
% The splitted commands \cs{hyper@linkstart} and \cs{hyper@linkend} are used for
% footnotemarks, toc and natbib-cites.
% \begin{function}{\hyper@link}
@@ -1768,7 +2035,8 @@
\__hyp_link_goto_end:
\group_end:
\Hy@VerboseLinkStop
- }{#3}
+ }
+ {{\let\protect\relax#3}}
}
\cs_new_protected:Npn \hyper@linkstart #1 #2 %#1 context, #2=destination name
@@ -1810,13 +2078,9 @@
{ \l_@@_text_enc_uri_print_tl }
\l_@@_uri_tmpa_tl
\pdfdict_put:nno{l_hyp/annot/A/URI}{URI}{\l_@@_uri_tmpa_tl}
- \ifHy@href@ismap
- \pdfdict_put:nnn{l_hyp/annot/A/URI}{IsMap}{true}
- \fi
- \tl_if_empty:NF \Hy@href@nextactionraw
+ \bool_if:NT \l_@@_href_url_ismap_bool
{
- \str_remove_once:Nn \Hy@href@nextactionraw {/Next}
- \pdfdict_put:nno{l_hyp/annot/A/Next}{\Hy@href@nextactionraw}
+ \pdfdict_put:nnn{l_hyp/annot/A/URI}{IsMap}{true}
}
\cs_set_eq:NN \# \c_hash_str
\cs_set_eq:NN \% \c_percent_str
@@ -1825,19 +2089,16 @@
\pdfannot_dict_put:nnx {link/URI}{A}{<<\pdfdict_use:n {l_hyp/annot/A/URI}>>}
\pdfannot_link:nxn { URI }
{
- % /A
-% <<
-% \pdfdict_use:n {l_hyp/annot/A/URI}
-% >>
}
{
+ \let\protect\relax
#1
\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#1}
+ {{\let\protect\relax#1}}
}
% \end{macrocode}
@@ -1847,52 +2108,60 @@
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{Type}{/Action}
\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{S}{/GoToR}
+
\cs_new_protected:Npn \hyper@linkfile #1 #2 #3 % link text, filename, destname
{
\bool_if:NTF \l_@@_annot_GoToR_bool
{
\group_begin:
- \tl_set:Nn \l_@@_filename_tmpa_tl { #2 }
- \Hy@CleanupFile \l_@@_filename_tmpa_tl
- \@@_text_pdfstring:ooN
- { \l_@@_filename_tmpa_tl }
- { \l_@@_text_enc_file_print_tl }
- \l_@@_filename_tmpa_tl
- \pdfdict_put:nno {l_hyp/annot/A/GoToR}{F}{\l_@@_filename_tmpa_tl}
+ \tl_set:Nx \l_@@_filename_tmpa_tl { \text_expand:n { #2 } }
+ \exp_args:Nx
+ \pdf_object_if_exist:nF { @@_file_\tl_to_str:N \l_@@_filename_tmpa_tl }
+ {
+ \pdfdict_put:nnx { l_pdffile/Filespec}{Subtype}{\pdf_name_from_unicode_e:n {application/pdf}}
+ \exp_args:Nnox
+ \pdffile_embed_file:nnn
+ {}
+ {\l_@@_filename_tmpa_tl }
+ {@@_file_\tl_to_str:N \l_@@_filename_tmpa_tl }
+ }
+ \pdfdict_put:nnx
+ {l_hyp/annot/A/GoToR}
+ {F}
+ {\pdf_object_ref:e {@@_file_\tl_to_str:N \l_@@_filename_tmpa_tl}}
\@@_text_pdfstring:nnN
{ #3 }
{ \l_@@_text_enc_dest_print_tl }
\l_@@_dest_name_tmpa_tl
- \Hy@MakeRemoteAction
\tl_if_blank:eTF {#3}
{
\pdfdict_put:nnx {l_hyp/annot/A/GoToR}{D}
- {[\Hy@href@page/\l_@@_dest_pdfremotestartview_tl]}
+ {
+ [
+ \int_eval:n
+ { \int_max:nn {0}{ 0\l_@@_href_pdf_page_tl - 1 }}
+ /\l_@@_dest_pdfremotestartview_tl
+ ]
+ }
}
{
\pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l_@@_dest_name_tmpa_tl}
}
- \tl_if_empty:NF \Hy@href@nextactionraw
- {
- \str_remove_once:Nn \Hy@href@nextactionraw {/Next}
- \pdfdict_put:nno{l_hyp/annot/A/Next}{Next}{\Hy@href@nextactionraw}
- }
\mode_leave_vertical:
- \pdfannot_dict_put:nnx {link/GoToR}{A}{<<\pdfdict_use:n {l_hyp/annot/A/GoToR}>>}
+ \pdf_object_unnamed_write:nx{dict}{\pdfdict_use:n {l_hyp/annot/A/GoToR}}
+ \pdfannot_dict_put:nnx {link/GoToR}{A}{\pdf_object_ref_last:}
\pdfannot_link:nxn %expansion??
{ GoToR }
{
- % /A<<
-% \pdfdict_use:n {l_hyp/annot/A/GoToR}
-% >>
}
{
+ \let\protect\relax
#1\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#1}
+ {{\let\protect\relax#1}}
}
% \end{macrocode}
%
@@ -1931,11 +2200,6 @@
\pdfdict_put:nnx {l_hyp/annot/A/Launch}{Win}
{<</P \l_@@_para_tmpa_tl /F \l_@@_filename_tmpa_tl >>}
}
- \tl_if_empty:NF \Hy@href@nextactionraw
- {
- \str_remove_once:Nn \Hy@href@nextactionraw {/Next}
- \pdfdict_put:nno{l_hyp/annot/A/Next}{Next}{\Hy@href@nextactionraw}
- }
\mode_leave_vertical:
\pdfannot_dict_put:nnx {link/Launch}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Launch}>>}
\pdfannot_link:nxn
@@ -1947,15 +2211,16 @@
% >>
}
{
+ \let\protect\relax
#2\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#2}
+ {{\let\protect\relax#2}}
}
% \end{macrocode}
-% The actually command used by hyperref is \cs{@hyper@launch} which uses a delimited
+% The actually command used by \pkg{hyperref} is \cs{@hyper@launch} which uses a delimited
% argument, because of the color the definition is a bit convoluted.
% \begin{macrocode}
\use:x
@@ -1984,11 +2249,6 @@
\mode_leave_vertical:
\pdfdict_put:nnx {l_hyp/annot/A/Named}{N}
{\pdf_name_from_unicode_e:n{#1}}
- \tl_if_empty:NF \Hy@href@nextactionraw
- {
- \str_remove_once:Nn \Hy@href@nextactionraw {/Next}
- \pdfdict_put:nno{l_hyp/annot/A/Next}{Next}{\Hy@href@nextactionraw}
- }
\pdfannot_dict_put:nnx {link/Named}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Named}>>}
\pdfannot_link:nxn { Named }
{
@@ -2009,7 +2269,7 @@
}
\group_end:
}
- {#2}
+ {{\let\protect\relax#2}}
}
% \end{macrocode}
@@ -2117,7 +2377,7 @@
% \end{macro}
% \subsection{Textcolor of links}
% colors are added in the hooks. This means that they can also be removed if needed.
-% They add a group---this isn't needed with hyperref code, but could be relevant
+% They add a group---this isn't needed with \pkg{hyperref} code, but could be relevant
% with low-level annotations.
% \begin{macrocode}
\prop_map_inline:Nn \c_@@_map_hyp_annot_prop
@@ -2472,19 +2732,9 @@
% These are the keys for ocgcolors. We try to disable it
% for pdf version below 1.5
% \begin{macrocode}
-\pdf_version_compare:NnTF < {1.5}
- {
- \keys_define:nn { hyp / setup }
- {
- ,_ocgcolorlinks .code:n =
- {
- \msg_warning:nnxx
- { hyp }
- { ignore-deprecated-or-unknown-option-in-pdf-version }
- { ocgcolorlinks } { \pdf_version_major:.\pdf_version_minor: }
- }
- }
- }
+\bool_lazy_or:nnTF
+ { \pdf_version_compare_p:Nn > {1.4} }
+ { \str_if_eq_p:ee{\pdf_version_major:}{-1} }
{
\keys_define:nn { hyp / setup }
{
@@ -2499,6 +2749,18 @@
,_ocgcolorlinks .default:n = true
}
}
+ {
+ \keys_define:nn { hyp / setup }
+ {
+ ,_ocgcolorlinks .code:n =
+ {
+ \msg_warning:nnxx
+ { hyp }
+ { ignore-deprecated-or-unknown-option-in-pdf-version }
+ { ocgcolorlinks } { \pdf_version_major:.\pdf_version_minor: }
+ }
+ }
+ }
\keys_define:nn { hyp / setup }
{
@@ -2519,7 +2781,15 @@
\seq_map_inline:Nn \c_@@_annot_types_seq
{
- \pdf_version_compare:NnTF < {1.5}
+ \bool_lazy_or:nnTF
+ { \pdf_version_compare_p:Nn > {1.4} }
+ { \str_if_eq_p:ee{\pdf_version_major:}{-1} }
+ {
+ \keys_define:nn { hyp / setup }
+ {
+ ,ocgcolor#1 .bool_set:c = { l_hyp_annot_ocgcolor#1_bool }
+ }
+ }
{
\keys_define:nn { hyp / setup }
{
@@ -2533,12 +2803,6 @@
}
}
}
- {
- \keys_define:nn { hyp / setup }
- {
- ,ocgcolor#1 .bool_set:c = { l_hyp_annot_ocgcolor#1_bool }
- }
- }
}
% \end{macrocode}
% \end{hypkey}
@@ -3678,7 +3942,7 @@
% set in the preamble for all pages or in the document for the current and the
% following pages. Due to the asynchronous page breaking one has to be careful
% to set it on the right page, e.g. only after a |\newpage|.
-% The generic driver uses a different syntax than the other hyperref drivers:
+% The generic driver uses a different syntax than the other \pkg{hyperref} drivers:
% various transition options can be set by a keyval syntax in the value of
% |pdfpagetransition|. A typical setting looks e.g. like this\\
% |\hypersetup{pdfpagetransition={style=Fly,duration=2,direction=90,opaque=false}}|