[latex3-commits] [git/LaTeX3-latex3-pdfresources] test-new-hooks: changed link hooks to new hook code (3bda0b3)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon May 18 18:27:14 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : test-new-hooks
Link       : https://github.com/latex3/pdfresources/commit/3bda0b37eaf5443c0e11b6fc015cbba974c612af

>---------------------------------------------------------------

commit 3bda0b37eaf5443c0e11b6fc015cbba974c612af
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon May 18 18:27:14 2020 +0200

    changed link hooks to new hook code


>---------------------------------------------------------------

3bda0b37eaf5443c0e11b6fc015cbba974c612af
 l3pdfmeta.dtx                | 12 ++++++--
 pdfresources.dtx             | 65 ++++++++++++++++++++++++--------------------
 testfiles-dvips/linkhook.pvt | 13 +++++----
 testfiles/linkhook.pvt       | 13 +++++----
 4 files changed, 59 insertions(+), 44 deletions(-)

diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index 04bee90..61d9994 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -154,12 +154,12 @@
 \str_new:N \g_@@_xmpmeta_str
 
 \str_gset:Nx      \g_@@_xmpmeta_str {<?xpacket~begin="\c_@@_meta_bom_str"~id="W5M0MpCehiHzreSzNTczkc9d"?>\iow_newline:}
-\str_put_right:Nx \g_@@_xmpmeta_str {<x:xmpmeta~xmlns:x="adobe:ns:meta/">\iow_newline:}
+\str_gput_right:Nx \g_@@_xmpmeta_str {<x:xmpmeta~xmlns:x="adobe:ns:meta/">\iow_newline:}
 
 %here more contents ...
-\str_put_right:Nx \g_@@_xmpmeta_str { </x:xmpmeta> \iow_newline: }
+\str_gput_right:Nx \g_@@_xmpmeta_str { </x:xmpmeta> \iow_newline: }
 %here padding??
-\str_put_right:Nn \g_@@_xmpmeta_str { <?xpacket~end="w"?> }
+\str_gput_right:Nn \g_@@_xmpmeta_str { <?xpacket~end="w"?> }
 %
 %    \end{macrocode}
 % \subsection{The stream object}
@@ -202,6 +202,12 @@
     ,max_nest_qQ     = 28
     ,Catalog/OCProperties    = false
     ,named_actions   = {NextPage, PrevPage, FirstPage, LastPage}
+    ,annot_flags     = {
+                         \pdfannot_flag_set:nn   {annot/Link}{Print}
+                         \pdfannot_flag_clear:nn {annot/Link}{Hidden}
+                         \pdfannot_flag_clear:nn {annot/Link}{Invisible}
+                         \pdfannot_flag_clear:nn {annot/Link}{NoView}
+                       }
     % to be continued https://docs.verapdf.org/validation/pdfa-part1/
   }
 
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 4659fd8..fa5ba54 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -3341,8 +3341,9 @@
  {
    \pdfdict_new:n { annot/Link/#1 }
    \pdfdict_put:nnn { annot/Link/#1}{ F }{ \pdfannot_flag_use:n { annot/Link} }
-   \hook_new:n {pdf/annot/Link/#1/before}
-   \hook_new:n {pdf/annot/Link/#1/after}
+   \hook_new_pair:nn
+     {pdf/annot/Link/#1/before}
+     {pdf/annot/Link/#1/after}
    \seq_new:c  { l_@@_hook_annot/Link/#1_begin_seq }
    \seq_new:c  { l_@@_hook_annot/Link/#1_end_seq }
  }
@@ -3382,10 +3383,11 @@
 \cs_new_protected:Nn \pdfannot_link:nnn %#1 type (URI, GoTo etc),
                                         %#2 action spec, #3 link text
   {
-    \seq_if_exist:cT { l_@@_hook_annot/Link/#1_begin_seq }
-      {
-        \seq_use:cn { l_@@_hook_annot/Link/#1_begin_seq }{}
-      }
+    %\seq_if_exist:cT { l_@@_hook_annot/Link/#1_begin_seq }
+%      {
+%        \seq_use:cn { l_@@_hook_annot/Link/#1_begin_seq }{}
+%      }
+    \hook_use:n { pdf/annot/Link/#1/before}
     \mode_leave_vertical:
     \exp_args:Nxx %xetex needs expansion
     \@@_backend_link_begin_user:nnw
@@ -3401,10 +3403,11 @@
       }
     #3
     \@@_backend_link_end:
-    \seq_if_exist:cT { l_@@_hook_annot/Link/#1_end_seq }
-      {
-        \seq_use:cn { l_@@_hook_annot/Link/#1_end_seq }{}
-      }
+    %\seq_if_exist:cT { l_@@_hook_annot/Link/#1_end_seq }
+%      {
+%        \seq_use:cn { l_@@_hook_annot/Link/#1_end_seq }{}
+%      }
+    \hook_use:n { pdf/annot/Link/#1/after}
   }
 %    \end{macrocode}
 % \begin{function}[added = 2020-03-12]{ \pdfannot_link_begin:nnw, \pdfannot_link_end:n }
@@ -3441,10 +3444,11 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \pdfannot_link_begin:nnw #1 #2 %#1 type, #2 action spec
   {
-    \seq_if_exist:cT { l_@@_hook_annot/Link/#1_begin_seq }
-      {
-        \seq_use:cn { l_@@_hook_annot/Link/#1_begin_seq }{}
-      }
+    %\seq_if_exist:cT { l_@@_hook_annot/Link/#1_begin_seq }
+%      {
+%        \seq_use:cn { l_@@_hook_annot/Link/#1_begin_seq }{}
+%      }
+    \hook_use:n { pdf/annot/Link/#1/before}
     \exp_args:Nxx %xetex needs expansion
       \@@_backend_link_begin_user:nnw
         {
@@ -3459,10 +3463,11 @@
 \cs_new_protected:Nn \pdfannot_link_end:n %#1 type, e.g. url
   {
     \@@_backend_link_end:
-    \seq_if_exist:cT {l_@@_hook_annot/Link/#1_end_seq}
-      {
-        \seq_use:cn { l_@@_hook_annot/Link/#1_end_seq }{}
-      }
+  %  \seq_if_exist:cT {l_@@_hook_annot/Link/#1_end_seq}
+%      {
+%        \seq_use:cn { l_@@_hook_annot/Link/#1_end_seq }{}
+%      }
+    \hook_use:n { pdf/annot/Link/#1/after}
   }
 %    \end{macrocode}
 % \begin{function}[updated = 2020-03-30]{ \pdfannot_link_goto_begin:nw, \pdfannot_link_goto_end: }
@@ -3476,7 +3481,8 @@
 %     \begin{macrocode}
 \cs_new_protected:Npn \pdfannot_link_goto_begin:nw #1 %#1 destination
   {
-    \seq_use:cn { l_@@_hook_annot/Link/GoTo_begin_seq }{}
+    %\seq_use:cn { l_@@_hook_annot/Link/GoTo_begin_seq }{}
+    \hook_use:n { pdf/annot/Link/GoTo/before}
     \exp_args:Nxx %xetex needs expansion
     \@@_backend_link_begin_goto:nnw
       {
@@ -3489,7 +3495,8 @@
 \cs_new_protected:Nn \pdfannot_link_goto_end:
   {
     \@@_backend_link_end:
-    \seq_use:cn { l_@@_hook_annot/Link/GoTo_end_seq }{}
+    %\seq_use:cn { l_@@_hook_annot/Link/GoTo_end_seq }{}
+    \hook_use:n { pdf/annot/Link/GoTo/before}
   }
 
 %    \end{macrocode}
@@ -3721,15 +3728,15 @@
 % \verb+l__<module>_hook_<hook-name>_prop+
 %
 %    \begin{macrocode}
-\cs_new:Nn \hook_put_right:nnn
- {
-  \seq_put_right:cn { l__#1_hook_#2_seq } { #3 }
- }
-
-\cs_new:Nn \hook_put_left:nnn
- {
-  \seq_put_left:cn { l__#1_hook_#2_seq } { #3 }
- }
+%\cs_new:Nn \hook_put_right:nnn
+% {
+%  \seq_put_right:cn { l__#1_hook_#2_seq } { #3 }
+% }
+%
+%\cs_new:Nn \hook_put_left:nnn
+% {
+%  \seq_put_left:cn { l__#1_hook_#2_seq } { #3 }
+% }
 
 %\cs_new:Nn \hook_put:nnnn
 % {
diff --git a/testfiles-dvips/linkhook.pvt b/testfiles-dvips/linkhook.pvt
index 3b1f0bd..fa7947d 100644
--- a/testfiles-dvips/linkhook.pvt
+++ b/testfiles-dvips/linkhook.pvt
@@ -23,25 +23,26 @@
 
 %add hooks:
 \ExplSyntaxOn\makeatletter
-\hook_put_left:nnn
+\hook_gput_code:nnn
+ {pdf/annot/Link/URI/before}
  { pdf }
- { annot/Link/URI_begin }
  {
   begin~url
  }
+
  \pdfdict_put:nnn
    {annot/Link/URI}
    { StructParent }
    { 123 }
 
-\hook_put_right:nnn
+\hook_gput_code:nnn
+ {pdf/annot/Link/URI/after}
  { pdf }
- { annot/Link/URI_end }
  {
-   end~url
+  end~url
  }
 
- \pdfdict_put:nnn
+\pdfdict_put:nnn
    {annot/Link/URI}
    { Contents }
    { (url) }
diff --git a/testfiles/linkhook.pvt b/testfiles/linkhook.pvt
index a1b1db3..fbb8489 100644
--- a/testfiles/linkhook.pvt
+++ b/testfiles/linkhook.pvt
@@ -15,25 +15,26 @@
 
 %add hooks:
 \ExplSyntaxOn\makeatletter
-\hook_put_left:nnn
+\hook_gput_code:nnn
+ {pdf/annot/Link/URI/before}
  { pdf }
- { annot/Link/URI_begin }
  {
   begin~url
  }
+
  \pdfdict_put:nnn
    {annot/Link/URI}
    { StructParent }
    { 123 }
 
-\hook_put_right:nnn
+\hook_gput_code:nnn
+ {pdf/annot/Link/URI/after}
  { pdf }
- { annot/Link/URI_end }
  {
-   end~url
+  end~url
  }
 
- \pdfdict_put:nnn
+\pdfdict_put:nnn
    {annot/Link/URI}
    { Contents }
    { (url) }





More information about the latex3-commits mailing list.