diff options
Diffstat (limited to 'macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx')
-rw-r--r-- | macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx | 110 |
1 files changed, 65 insertions, 45 deletions
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx index 906dd58152..e3d84d6ec6 100644 --- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx +++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx @@ -86,7 +86,7 @@ % }^^A % } % -% \date{Version 0.95f, released 2021-06-29} +% \date{Version 0.95g, released 2021-07-21} % % \maketitle % \begin{documentation} @@ -133,14 +133,13 @@ % it is recommended for most options ---with the exception of a few mentioned below in % section~\ref{sec:pkg-options}---to set them in \cs{hypersetup}, % not as package option. -% \item This driver uses \pkg{l3color} for the colors. All colors +% \item This driver uses the \pkg{l3color} module for the colors. All colors % defined with \cs{color_set:nn} or \cs{color_set:nnn} will work. % Colors defined with \pkg{xcolor} will work if they don't use one of % the special color models not supported by \pkg{l3color} as % \pkg{pdfmanagement-firstaid} contains a patch for xcolor. % If the package \pkg{color} is used it is currently recommended to define -% colors after \pkg{hyperref}. This driver uses \pkg{l3color} for the colors, -% some special color models of \pkg{xcolor} won't work. +% colors after \pkg{hyperref}. % \item Load a color package or graphicx to get the right page sizes. % \item Report problems! Only known problem can be resolved. % \end{itemize} @@ -859,11 +858,11 @@ %^^A %% drivers are loaded in line 4745 in hyperref.sty in a \Hy@AtEndOfPackage command. %^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%% %^^A %% list of new internal commands -%^^A %% __hyp_link_goto_begin:nw : start command for links to internal destination +%^^A %% @@_link_goto_begin:nw : start command for links to internal destination %^^A %% replaces \find@pdflink -%^^A %% __hyp_link_goto_end: -%^^A %% __hyp_destination:n : sets an anchor, replaces \new@pdflink -%^^A %% \__hyp_PageLabels_gpush: : puts pagelabels in the catalog, used on every storing +%^^A %% @@_link_goto_end: +%^^A %% @@_destination:n : sets an anchor, replaces \new@pdflink +%^^A %% \@@_PageLabels_gpush: : puts pagelabels in the catalog, used on every storing %^^A %% PDF String (text) %^^A %% *\@@_text_pdfstring:nnN : replaces Hy@pstringdef, converts #1 to pdfstring in encoding #2 %^^A %% and stores in N @@ -882,10 +881,10 @@ %^^A %% % helps to display key list messages %^^A %% \@@_clist_display:n %^^A %% -%^^A %% \__hyp_info_generate_addons: what did this do?? +%^^A %% \@@_info_generate_addons: what did this do?? %^^A %% -%^^A %% \g__hyp_AcroForm_CoFields_prop -%^^A %% \g__hyp_AcroForm_Fields_prop +%^^A %% \g_@@_AcroForm_CoFields_prop +%^^A %% \g_@@_AcroForm_Fields_prop %^^A %% %^^A %% \g_@@_dest_pdfstartpage_tl , %^^A %% \g_@@_dest_pdfstartview_tl , @@ -922,7 +921,7 @@ %<@@=hyp> % \end{macrocode} % \begin{macrocode} -\ProvidesFile{hgeneric-testphase.def}[2021-06-29 v0.95f % +\ProvidesFile{hgeneric-testphase.def}[2021-07-21 v0.95g % generic Hyperref driver for the LaTeX PDF management testphase bundle] \RequirePackage{etoolbox} %why? @@ -1244,10 +1243,10 @@ \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_@@_text_enc_uri_print_tl {utf8/URI} } { - \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string} + \tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} } \@ifnextchar\bgroup\Hy@href{\hyper@normalise\href@}% } @@ -1274,10 +1273,10 @@ \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_@@_text_enc_uri_print_tl {utf8/URI} } { - \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string} + \tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} } \hyper@normalise\@@_href_url_aux:nn} @@ -1319,7 +1318,7 @@ \cs_new_protected:Npn \@@_href_run_aux:nn #1 #2 { - \exp_args:Nnno\hyper@linklaunch{#2}{#1}{\l_@@_href_run_parameter_tl} + \exp_args:Nnno\hyper@linklaunch{#1}{#2}{\l_@@_href_run_parameter_tl} \group_end: \hook_use:n{cmd/hrefrun/after} } @@ -1336,10 +1335,10 @@ \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_@@_text_enc_uri_print_tl {utf8/URI} } { - \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string} + \tl_set:Nn \l_@@_text_enc_uri_print_tl {utf8/string} } \hyper@normalise\@@_href_url_aux:n } @@ -1959,17 +1958,27 @@ % xetex version. It is not quite clear if really all three % are needed for the backends supported by this driver, but changing the hyperref % code would be difficult. +% We add a hook. This allows e.g. the tagging code +% to create also a structured destination. +% We don't use the cmd hook, as we want the same hook for both start commands. +% We make the current dest name available so that the hook code can use it. % \begin{macro} % { % \hyper@anchor, % \hyper@anchorstart, -% \hyper@anchorend +% \hyper@anchorend, +% hyp/anchor, +% \l_hyp_current_dest_name_tl % } % \begin{macrocode} +\tl_new:N\l_hyp_current_dest_name_tl +\hook_new:n{hyp/anchor} \cs_new_protected:Npn \hyper@anchor #1 { \exp_args:NnV \@@_destination:nn {#1} \l_@@_dest_pdfview_tl + \tl_set:Nn \l_hyp_current_dest_name_tl {#1} + \hook_use:n{hyp/anchor} } \cs_new_protected:Npn \hyper@anchorstart #1 @@ -1977,6 +1986,8 @@ \Hy@activeanchortrue \exp_args:NnV \@@_destination:nn {#1} \l_@@_dest_pdfview_tl + \tl_set:Nn \l_hyp_current_dest_name_tl {#1} + \hook_use:n{hyp/anchor} } \cs_new_protected:Npn \hyper@anchorend @@ -2059,7 +2070,9 @@ % \end{function} % \pkg{hyperref} adds a group with \cs{Hy@colorlink}, we move this outside the link -% so that it groups the context hook too. +% so that it groups the context hook too. We store again the destination name in the +% public tl |\l_hyp_current_dest_name_tl| so that the hook code can make use of +% it % \begin{macrocode} \cs_new_protected:Npn \hyper@link #1 #2 #3 %#1 context, #2=destination name, #3 content @@ -2068,9 +2081,10 @@ { \Hy@VerboseLinkStart{#1}{#2} \group_begin: + \tl_set:Nn \l_hyp_current_dest_name_tl {#2} \hook_use:n {hyp/link/#1} \@@_link_goto_begin:nw {#2}#3\Hy@xspace@end - \__hyp_link_goto_end: + \@@_link_goto_end: \group_end: \Hy@VerboseLinkStop } @@ -2083,6 +2097,7 @@ { \Hy@VerboseLinkStart{#1}{#2}% only for debug \group_begin: + \tl_set:Nn \l_hyp_current_dest_name_tl {#2} \hook_use:n {hyp/link/#1} \@@_link_goto_begin:nw {#2} } @@ -2186,6 +2201,11 @@ \pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l_@@_dest_name_tmpa_tl} } \mode_leave_vertical: +% \end{macrocode} +% We use an extra object here, as ghostscript doesn't like the +% object reference in the dict +% \url{https://chat.stackexchange.com/transcript/message/57361080#57361080} +% \begin{macrocode} \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?? @@ -4131,14 +4151,14 @@ % clearly faster than removing them from a sequence \def\HyField@AuxAddToFields#1 { - \prop_gput:Nnn \g__hyp_AcroForm_Fields_prop {#1}{F} + \prop_gput:Nnn \g_@@_AcroForm_Fields_prop {#1}{F} }% %fields with empty key get a value too -- lets hope that %this give the expected behaviour \def\HyField@AuxAddToCoFields #1 #2 { - \prop_gput:Nnn \g__hyp_AcroForm_CoFields_prop {a#1}{#2} + \prop_gput:Nnn \g_@@_AcroForm_CoFields_prop {a#1}{#2} } \Hy@AtBeginDocument @@ -4196,9 +4216,9 @@ \ExplSyntaxOff \ExplSyntaxOn \tl_new:N \l_@@_CheckmarkYes_tl -\tl_set:Nn \l_@@_CheckmarkYes_tl { __hyp_xform_CheckMarkYes } +\tl_set:Nn \l_@@_CheckmarkYes_tl { @@_xform_CheckMarkYes } \tl_new:N \l_@@_CheckmarkOff_tl -\tl_set:Nn \l_@@_CheckmarkOff_tl { __hyp_xform_CheckMarkOff } +\tl_set:Nn \l_@@_CheckmarkOff_tl { @@_xform_CheckMarkOff } \def\@Form[#1] { @@ -4207,14 +4227,14 @@ \pdf@ifdraftmode{} { \Hy@FormObjects - \prop_map_inline:Nn \g__hyp_AcroForm_Fields_prop + \prop_map_inline:Nn \g_@@_AcroForm_Fields_prop { \pdfmanagement_add:nnx { Catalog / AcroForm } { Fields }{##1} %\pdfmanagement_show:n { Catalog / AcroForm } } - \prop_if_empty:NF \g__hyp_AcroForm_CoFields_prop + \prop_if_empty:NF \g_@@_AcroForm_CoFields_prop { - \prop_map_inline:Nn \g__hyp_AcroForm_CoFields_prop + \prop_map_inline:Nn \g_@@_AcroForm_CoFields_prop { \seq_put_right:Nn \l_@@_tmpa_seq {##1} } @@ -4230,7 +4250,7 @@ \pdfmanagement_add:nnx { Catalog / AcroForm } { CO } { - \prop_item:Nn \g__hyp_AcroForm_CoFields_prop {##1} + \prop_item:Nn \g_@@_AcroForm_CoFields_prop {##1} } } } @@ -4262,7 +4282,7 @@ \char123 \group_end: } - {__hyp_xform_Ding} + {@@_xform_Ding} \MakeFieldObject { \group_begin: @@ -4274,7 +4294,7 @@ \phantom{\char123} \group_end: } - {__hyp_xform_DingOff} + {@@_xform_DingOff} \MakeFieldObject { \group_begin: @@ -4286,7 +4306,7 @@ \char51 \group_end: } - {__hyp_xform_CheckMarkYes} + {@@_xform_CheckMarkYes} \MakeFieldObject { \group_begin: @@ -4298,17 +4318,17 @@ \phantom{\char51} %perhaps xetex needs some small glyph .. \group_end: } - {__hyp_xform_CheckMarkOff} + {@@_xform_CheckMarkOff} \MakeFieldObject { \fbox{\textcolor{yellow}{\textsf{Submit}}} %color? } - {__hyp_xform_Submit} + {@@_xform_Submit} \MakeFieldObject { \fbox{\textcolor{yellow}{\textsf{SubmitP}}} %color? } - {__hyp_xform_SubmitP} + {@@_xform_SubmitP} } \ExplSyntaxOff \let\@endForm\ltx@empty @@ -4324,16 +4344,16 @@ %\zref@labelbyprops{HyAnn@\the\HyAnn@Count}{abspage}% %\zref@labelbylist {HyAnn@\the\HyAnn@Count} {l3pdf} %\zref@refused{HyAnn@\the\HyAnn@Count}% - \__hyp_ref_label:en {HyAnn@\the\HyAnn@Count}{abspage} - \__hyp_ref_check:en {HyAnn@\the\HyAnn@Count}{abspage} + \@@_ref_label:en {HyAnn@\the\HyAnn@Count}{abspage} + \@@_ref_check:en {HyAnn@\the\HyAnn@Count}{abspage} }% \def\Fld@pageobjref { - \__hyp_ref_if_exist:enT {HyAnn@\the\HyAnn@Count}{abspage} + \@@_ref_if_exist:enT {HyAnn@\the\HyAnn@Count}{abspage} { /P~\pdf_pageobject_ref:n { - \__hyp_ref_value:en{HyAnn@\the\HyAnn@Count}{abspage} + \@@_ref_value:en{HyAnn@\the\HyAnn@Count}{abspage} } } } @@ -4449,7 +4469,7 @@ \endgroup } \tl_new:N \l_@@_RadioYes_tl -\tl_set:Nn \l_@@_RadioYes_tl { __hyp_xform_Ding } +\tl_set:Nn \l_@@_RadioYes_tl { @@_xform_Ding } \def\@@Radio#1{% \Fld@listcount=0~% %\show\Fld@default @@ -4474,8 +4494,8 @@ << /N << - /\@currValue\c_space_tl \pdfxform_ref:o {__hyp_xform_Ding} - %/Off \c_space_tl \pdfxform_ref:n {__hyp_xform_DingOff} %hm + /\@currValue\c_space_tl \pdfxform_ref:o {@@_xform_Ding} + %/Off \c_space_tl \pdfxform_ref:n {@@_xform_DingOff} %hm >> >> } @@ -4569,8 +4589,8 @@ { \PDFForm@Submit /AP<< - /N~\pdfxform_ref:n {__hyp_xform_Submit}~ - /D~\pdfxform_ref:n {__hyp_xform_SubmitP} + /N~\pdfxform_ref:n {@@_xform_Submit}~ + /D~\pdfxform_ref:n {@@_xform_SubmitP} >> } \HyField@AddToFields |