[latex3-commits] [git/LaTeX3-latex3-pdfresources] master: renamed link types to use standard pdf names instead of the hyperref names (b33b598)
Ulrike Fischer
fischer at troubleshooting-tex.de
Mon Mar 30 14:11:49 CEST 2020
Repository : https://github.com/latex3/pdfresources
On branch : master
Link : https://github.com/latex3/pdfresources/commit/b33b598cb6662ec8f81a11cb9412417e013e55b7
>---------------------------------------------------------------
commit b33b598cb6662ec8f81a11cb9412417e013e55b7
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Mar 30 14:11:49 2020 +0200
renamed link types to use standard pdf names instead of the hyperref names
>---------------------------------------------------------------
b33b598cb6662ec8f81a11cb9412417e013e55b7
hgeneric-experimental.def | 34 +++++++++++++++++++++-------------
pdfresources.dtx | 13 +++++++------
testfiles-dvips/linkhook.pvt | 10 +++++-----
testfiles/linkhook.pvt | 10 +++++-----
4 files changed, 38 insertions(+), 29 deletions(-)
diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index 6d4307d..c7f4700 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -155,6 +155,14 @@
\bool_set_true:N \l__hyp_pdfa_bool
\fi
+\prop_const_from_keyval:Nn \c__hyp_map_linktypes_prop
+ {
+ URI = url,
+ GoTo = link,
+ GoToR = file,
+ Named = menu,
+ Launch= run
+ }
% this need sorting out later. pdf standards should be handled outside the driver.
% pdfa forces the flag /F 4 in some places.
@@ -164,25 +172,25 @@
{
\hook_put:nnnn
{ pdf }
- { link_begin_url_attr }
+ { link_begin_URI_attr }
{ F }
{ 4 }
\hook_put:nnnn
{ pdf }
- { link_begin_link_attr }
+ { link_begin_GoTo_attr }
{ F }
{ 4 }
\hook_put:nnnn
{ pdf }
- { link_begin_file_attr }
+ { link_begin_GoToR_attr }
{ F }
{ 4 }
\hook_put:nnnn
{ pdf }
- { link_begin_menu_attr }
+ { link_begin_Named_attr }
{ F }
{ 4 }
}
@@ -247,13 +255,13 @@
{
\seq_map_inline:Nn \c_pdf_link_types_seq
{
- \tl_if_exist:cTF { @##1bordercolor }
+ \tl_if_exist:cTF { @\prop_item:Nn\c__hyp_map_linktypes_prop{##1}bordercolor }
{
\hook_put:nnnn
{ pdf }
{ link_begin_##1_attr }
{ C }
- { [\tl_use:c {@##1bordercolor}] }
+ { [\tl_use:c {@\prop_item:Nn\c__hyp_map_linktypes_prop{##1}bordercolor}] }
}
{
\hook_remove:nnn { pdf } { link_begin_##1_attr } { C }
@@ -577,14 +585,14 @@
}
}
\exp_args:Nno
- \pdf_link_begin_goto:nnw { link } { \l__hyp_destname_tmpa_tl }
+ \pdf_link_begin_goto:nnw { GoTo } { \l__hyp_destname_tmpa_tl }
\Hy at colorlink\@linkcolor
}
\cs_new_protected:Npn \__hyp_link_dest_end:
{
\Hy at endcolorlink
- \pdf_link_end:n { link }
+ \pdf_link_end:n { GoTo }
}
%% hyperref commands for destinations (anchor) and links to destinations
@@ -643,7 +651,7 @@
\mode_leave_vertical:
%Subtype and A could probably also be handled with hooks if needed
%but checks for all drivers should be done then.
- \pdf_link_user:nnn { url }
+ \pdf_link_user:nnn { URI }
{
/Subtype /Link
/A
@@ -681,7 +689,7 @@
\Hy at MakeRemoteAction
\mode_leave_vertical:
\pdf_link_user:nnn %expansion??
- { file }
+ { GoToR }
{
/Subtype /Link
/A<<
@@ -724,7 +732,7 @@
%\Hy at pstringdef\Hy at pstringP{#3}%
\mode_leave_vertical:
\pdf_link_user:nnn %expansion?
- { run }
+ { Launch }
{
/Subtype /Link
/A<<
@@ -886,7 +894,7 @@
\pdf_catalog_gremove:n { ViewerPreferences / NumCopies }
}
{
- \pdf_catalog_gput:nn {ViewerPreferences }{{NumCopies}{~#1}}
+ \pdf_catalog_gput:nn {ViewerPreferences }{{NumCopies}{#1}}
}
}
{
@@ -1203,7 +1211,7 @@
\Hy at Acrobatmenu{#1}{#2}{%
\mode_leave_vertical:
\EdefEscapeName\Hy at temp@menu{#1}%
- \pdf_link_user:nnn { menu }
+ \pdf_link_user:nnn { Named }
{
/Subtype /Link
/A<<
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 8f816b1..3b38747 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -2678,7 +2678,8 @@
% ordering.
%
% The code assumes that there will be different link types
-% (currently url, file, run, link, menu) and that
+% (currently URI, GoToR, Launch, GoTo, Named, hyperref uses the names
+% url,file,run,link,menu) and that
% links of the same type share the \emph{attr spec} and also the same begin/end
% code. The list of link types need to stay restricted and well documented so that
% all packages know which types they have to handle. It is stored in a constant
@@ -2704,7 +2705,7 @@
%
% \begin{macrocode}
-\seq_const_from_clist:Nn \c_pdf_link_types_seq { url , file , run , link, menu }
+\seq_const_from_clist:Nn \c_pdf_link_types_seq { URI , GoToR , Launch , GoTo, Named }
\seq_map_inline:Nn \c_pdf_link_types_seq
{
@@ -2727,7 +2728,7 @@
% hook of type \Arg{type} are inserted as \emph{attr spec} and the code in
% the begin and end hook is executed before and after the link. As example
% \begin{verbatim}
-% \pdf_link_user:nnn { url }
+% \pdf_link_user:nnn { URI }
% {
% /Subtype /Link
% /A<<
@@ -2741,7 +2742,7 @@
% \end{function}
%
% \begin{macrocode}
-\cs_new_protected:Nn \pdf_link_user:nnn %#1 type (url, file etc),
+\cs_new_protected:Nn \pdf_link_user:nnn %#1 type (URI, GoTo etc),
%#2 action spec, #3 link text
{
\seq_if_exist:cT { l_@@_hook_link_begin_#1_seq }
@@ -2790,7 +2791,7 @@
% hook of type \meta{type} are inserted as \emph{attr spec} and the code in
% the begin and end hook is executed before and after the link. As example
% \begin{verbatim}
-% \pdf_link_begin_user:nnw { url }
+% \pdf_link_begin_user:nnw { URI }
% {
% /Subtype /Link
% /A<<
@@ -2800,7 +2801,7 @@
% >>
% }
% link text
-% \pdf_link_end:n { url }
+% \pdf_link_end:n { URI }
% \end{verbatim}
% \end{function}
% \begin{macrocode}
diff --git a/testfiles-dvips/linkhook.pvt b/testfiles-dvips/linkhook.pvt
index 1060cc0..e271238 100644
--- a/testfiles-dvips/linkhook.pvt
+++ b/testfiles-dvips/linkhook.pvt
@@ -25,31 +25,31 @@
\ExplSyntaxOn\makeatletter
\hook_put_left:nnn
{ pdf }
- { link_begin_url }
+ { link_begin_URI }
{
begin~url
}
\hook_put:nnnn
{ pdf }
- { link_begin_url_attr }
+ { link_begin_URI_attr }
{ StructParent }
{ 123 }
\hook_put_right:nnn
{ pdf }
- { link_end_url }
+ { link_end_URI }
{
end~url
}
\hook_put:nnnn
{ pdf }
- { link_begin_url_attr }
+ { link_begin_URI_attr }
{ Contents }
{ (url) }
\hook_put:nnnn
{ pdf }
- { link_begin_link_attr }
+ { link_begin_GoTo_attr }
{ Contents }
{ (ref) }
diff --git a/testfiles/linkhook.pvt b/testfiles/linkhook.pvt
index 9f2c2fb..f0c7ecb 100644
--- a/testfiles/linkhook.pvt
+++ b/testfiles/linkhook.pvt
@@ -17,31 +17,31 @@
\ExplSyntaxOn\makeatletter
\hook_put_left:nnn
{ pdf }
- { link_begin_url }
+ { link_begin_URI }
{
begin~url
}
\hook_put:nnnn
{ pdf }
- { link_begin_url_attr }
+ { link_begin_URI_attr }
{ StructParent }
{ 123 }
\hook_put_right:nnn
{ pdf }
- { link_end_url }
+ { link_end_URI }
{
end~url
}
\hook_put:nnnn
{ pdf }
- { link_begin_url_attr }
+ { link_begin_URI_attr }
{ Contents }
{ (url) }
\hook_put:nnnn
{ pdf }
- { link_begin_link_attr }
+ { link_begin_GoTo_attr }
{ Contents }
{ (ref) }
More information about the latex3-commits
mailing list.