summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def')
-rw-r--r--Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def265
1 files changed, 205 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def
index aa58d10853b..98d06175e9d 100644
--- a/Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def
+++ b/Master/texmf-dist/tex/latex/pdfmanagement-testphase/hgeneric-testphase.def
@@ -19,8 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: hyperref-generic.dtx
-\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?
@@ -152,6 +151,7 @@
No~value~is~equivalent~to~using~`true`.
}
\cs_generate_variant:Nn\pdf_destination:nn {nf}
+\cs_generate_variant:Nn\pdf_object_ref:n {e}
\chardef\Hy@VersionChecked=1 %don't check the version!
\cs_set_eq:NN \hypercalcbp \dim_to_decimal_in_bp:n
\providecommand\@pdfborder{}
@@ -186,6 +186,150 @@
{ hyp~/~setup }{ \l_keys_key_str } { #1 }
}
}
+
+\bool_new:N \l__hyp_href_url_encode_bool
+\bool_new:N \l__hyp_href_url_ismap_bool
+\tl_new:N \l__hyp_href_url_protocol_tl
+\tl_new:N \l__hyp_href_pdf_destination_tl
+\tl_new:N \l__hyp_href_pdf_page_tl
+\tl_new:N \l__hyp_href_run_parameter_tl
+\cs_new_protected:Npn \__hyp_href_url_format {\begingroup\Url}
+
+\keys_define:nn { hyp / href }
+ {
+ ,urlencode .bool_set:N = \l__hyp_href_url_encode_bool
+ ,format .code:n = { \cs_set_eq:NN \__hyp_href_url_format #1 },
+ ,protocol .tl_set:N = \l__hyp_href_url_protocol_tl
+ ,destination .tl_set:N = \l__hyp_href_pdf_destination_tl
+ ,pdfremotestartview .code:n =
+ {
+ \keys_set:nn { hyp / setup }
+ { pdfremotestartview = #1 }
+ }
+ ,page .code:n =
+ {
+ \tl_set:Nn \l__hyp_href_pdf_page_tl {#1}
+ \tl_set:Nn \Hy@href@page {#1}
+ }
+ ,ismap .bool_set:N = \l__hyp_href_url_ismap_bool
+ ,run-parameter .tl_set:N = \l__hyp_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__hyp_href_url_encode_bool
+ ,href / urlencode .default:n = {true}
+ ,href / urlencode .initial:n = {false}
+ ,href / protocol .tl_set:N = \l__hyp_href_url_protocol_tl
+ ,href / destination .tl_set:N = \l__hyp_href_pdf_destination_tl
+ ,href / format .code:n = { \cs_set_eq:NN \__hyp_href_url_format #1 }
+ }
+
+\DeclareRobustCommand*{\href}[1][]{%
+ \begingroup
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \bool_if:NTF \l__hyp_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__hyp_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\__hyp_href_url_aux:nn}
+
+\cs_new_protected:Npn \__hyp_href_url_aux:nn #1 #2
+ {
+ \exp_args:Nno\hyper@linkurl{#2}{\l__hyp_href_url_protocol_tl#1}
+ \group_end:
+ }
+
+\DeclareRobustCommand*{\hrefpdf}[1][]
+ {
+ \begingroup
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \hyper@normalise\__hyp_href_pdf_aux:nn
+ }
+
+\cs_new_protected:Npn \__hyp_href_pdf_aux:nn #1 #2
+ {
+ \exp_args:Nnno\hyper@linkfile{#2}{#1}{\l__hyp_href_pdf_destination_tl}\endgroup
+ }
+
+\DeclareRobustCommand*{\hrefrun}[1][]
+ {
+ \group_begin:
+ \keys_set:nn { hyp / href } {#1}
+ \let\protect\@unexpandable@protect
+ \hyper@normalise\__hyp_href_run_aux:nn
+ }
+
+\cs_new_protected:Npn \__hyp_href_run_aux:nn #1 #2
+ {
+ \exp_args:Nnno\hyper@linklaunch{#2}{#1}{\l__hyp_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__hyp_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\__hyp_href_url_aux:n
+ }
+
+\cs_new_protected:Npn \__hyp_href_url_aux:n #1
+ {
+ \exp_args:Nno
+ \hyper@linkurl{\__hyp_href_url_format {#1}}
+ {\l__hyp_href_url_protocol_tl#1}
+ \group_end:
+ }
+
+\NewExpandableDocumentCommand\__hyp_secondoftwowithopt:wnn {omm}{#3}
+\pdfstringdefDisableCommands{\let\hrefurl\__hyp_secondoftwowithopt:wnn}
+\pdfstringdefDisableCommands{\let\hrefpdf\__hyp_secondoftwowithopt:wnn}
+\pdfstringdefDisableCommands{\let\hrefrun\__hyp_secondoftwowithopt:wnn}
\cs_new_protected:Npn \__hyp_store_metadata:nn #1 #2 %#1 key, #2 value.
{
%\tl_set:cn {@#1}{#2}
@@ -456,7 +600,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
@@ -493,13 +638,9 @@
{ \l__hyp_text_enc_uri_print_tl }
\l__hyp_uri_tmpa_tl
\pdfdict_put:nno{l_hyp/annot/A/URI}{URI}{\l__hyp_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__hyp_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
@@ -508,16 +649,16 @@
\pdfannot_dict_put:nnx {link/URI}{A}{<<\pdfdict_use:n {l_hyp/annot/A/URI}>>}
\pdfannot_link:nxn { URI }
{
- % /A
}
{
+ \let\protect\relax
#1
\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#1}
+ {{\let\protect\relax#1}}
}
\pdfdict_new:n {l_hyp/annot/A/GoToR}
@@ -529,45 +670,54 @@
\bool_if:NTF \l__hyp_annot_GoToR_bool
{
\group_begin:
- \tl_set:Nn \l__hyp_filename_tmpa_tl { #2 }
- \Hy@CleanupFile \l__hyp_filename_tmpa_tl
- \__hyp_text_pdfstring:ooN
- { \l__hyp_filename_tmpa_tl }
- { \l__hyp_text_enc_file_print_tl }
- \l__hyp_filename_tmpa_tl
- \pdfdict_put:nno {l_hyp/annot/A/GoToR}{F}{\l__hyp_filename_tmpa_tl}
+ \tl_set:Nx \l__hyp_filename_tmpa_tl { \text_expand:n { #2 } }
+ \exp_args:Nx
+ \pdf_object_if_exist:nF { __hyp_file_\tl_to_str:N \l__hyp_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__hyp_filename_tmpa_tl }
+ {__hyp_file_\tl_to_str:N \l__hyp_filename_tmpa_tl }
+ }
+ \pdfdict_put:nnx
+ {l_hyp/annot/A/GoToR}
+ {F}
+ {\pdf_object_ref:e {__hyp_file_\tl_to_str:N \l__hyp_filename_tmpa_tl}}
\__hyp_text_pdfstring:nnN
{ #3 }
{ \l__hyp_text_enc_dest_print_tl }
\l__hyp_dest_name_tmpa_tl
- \Hy@MakeRemoteAction
\tl_if_blank:eTF {#3}
{
\pdfdict_put:nnx {l_hyp/annot/A/GoToR}{D}
- {[\Hy@href@page/\l__hyp_dest_pdfremotestartview_tl]}
+ {
+ [
+ \int_eval:n
+ { \int_max:nn {0}{ 0\l__hyp_href_pdf_page_tl - 1 }}
+ /\l__hyp_dest_pdfremotestartview_tl
+ ]
+ }
}
{
\pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l__hyp_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<<
}
{
+ \let\protect\relax
#1\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#1}
+ {{\let\protect\relax#1}}
}
\pdfdict_new:n {l_hyp/annot/A/Launch}
\pdfdict_put:nnn {l_hyp/annot/A/Launch}{Type}{/Action}
@@ -600,11 +750,6 @@
\pdfdict_put:nnx {l_hyp/annot/A/Launch}{Win}
{<</P \l__hyp_para_tmpa_tl /F \l__hyp_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
@@ -613,12 +758,13 @@
% /A
}
{
+ \let\protect\relax
#2\Hy@xspace@end
\Hy@VerboseLinkStop %where is the start??
}
\group_end:
}
- {#2}
+ {{\let\protect\relax#2}}
}
\use:x
{ % filename, anchor text, linkname
@@ -641,11 +787,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 }
{
@@ -662,7 +803,7 @@
}
\group_end:
}
- {#2}
+ {{\let\protect\relax#2}}
}
\cs_new_protected:Npn \__hyp_color_export:nnN #1 #2 #3
@@ -1002,19 +1143,9 @@
}
}
}
-\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 }
{
@@ -1029,6 +1160,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 }
{
@@ -1049,7 +1192,15 @@
\seq_map_inline:Nn \c__hyp_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 }
{
@@ -1063,12 +1214,6 @@
}
}
}
- {
- \keys_define:nn { hyp / setup }
- {
- ,ocgcolor#1 .bool_set:c = { l_hyp_annot_ocgcolor#1_bool }
- }
- }
}
\prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
{