[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: better test if hooks exist (d399138)

Ulrike Fischer fischer at troubleshooting-tex.de
Fri Apr 19 22:21:52 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/d399138a1032588540298d89aa7c3a845cee90df

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

commit d399138a1032588540298d89aa7c3a845cee90df
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri Apr 19 22:21:52 2019 +0200

    better test if hooks exist


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

d399138a1032588540298d89aa7c3a845cee90df
 pdfresources.dtx |   96 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 86 insertions(+), 10 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index 70d4576..7f95575 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -200,6 +200,25 @@
  {
   \pdfdest~{#1}#2\scan_stop:
  }
+
+% this needs refinement, probably is should create named objects and add
+% them to the properties, see discussion
+%
+\cs_new_protected:Npx \driver_pdf_bdc:nn #1 #2
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{#1~#2~BDC} }
+      { \tex_pdfliteral:D~page~{#1~#2~BDC}  }
+  }
+
+
+\cs_new_protected:Npx \driver_pdf_emc:
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{EMC} }
+      { \tex_pdfliteral:D~page~{EMC}  }
+  }
+
 \input{l3pdfmode-pdf.def}
 }
 
@@ -215,11 +234,45 @@
   \pdfextension~dest~name~{#1}#2 \scan_stop:
  }
 
+\cs_new_protected:Npx \driver_pdf_bdc:nn #1 #2
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{#1~#2~BDC} }
+      { \tex_pdfliteral:D~page~{#1~#2~BDC}  }
+  }
+
+
+\cs_new_protected:Npx \driver_pdf_emc:
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{EMC} }
+      { \tex_pdfliteral:D~page~{EMC}  }
+  }
+
 \input{l3pdfmode-pdf.def}
 }
 
 \sys_if_engine_xetex:T
 {
+ %% need to be checked if resources are ok!!!!
+ \cs_new_protected:Npn \driver_pdf_bmc:n #1
+  {
+    \special{pdf:code~#1~BMC}
+    %\special{pdf:content~#1~BMC}%
+  }
+
+\cs_new_protected:Npn \driver_pdf_bdc:nn #1 #2
+  {
+    \special{pdf:code~#1~#2~BDC}
+    %\special{pdf:content~#1~#2~BDC}%accsupp
+  }
+
+\cs_new_protected:Npn \driver_pdf_emc:
+  {
+    \special{pdf:code~EMC}
+    %\special{pdf:content EMC}%accsupp
+  }
+
  %% \cs_new_protected:Nn \driver_pdf_catalog:n ????
  \input{l3dvipdfmx-pdf.def}
 }
@@ -335,6 +388,7 @@
 \prop_new:N\l__pdf_hook_startlink_file_attr_prop %\hyper at linkfile
 \prop_new:N\l__pdf_hook_startlink_run_attr_prop  %\@hyper at launch run
 \prop_new:N\l__pdf_hook_startlink_link_attr_prop %\hyper at link, \find at pdflink
+\prop_new:N\l__pdf_hook_startlink_menu_attr_prop %\Acrobatmenu
 %</package>
 %    \end{macrocode}
 %
@@ -346,13 +400,19 @@
 %<*package>
 \cs_new_protected:Nn \pdf_link_user:nnn %#1 type (url, file etc, #2 action spec, #3 link text
  {
-   \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+   \seq_if_exist:cT { l__pdf_hook_startlink_#1_seq }
+   {
+    \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+   }
    \mode_leave_vertical:
    \driver_pdf_link_user:nnn
     {
+     \prop_if_exist:cT { l__pdf_hook_startlink_#1_attr_prop }
+     {
       \prop_map_function:cN
        { l__pdf_hook_startlink_#1_attr_prop }
        \__pdf_get_key_value:nn
+      }
     }
     {
       #2
@@ -368,12 +428,18 @@
 %<*package>
 \cs_new_protected:Nn \pdf_startlink_user:nn %#1 type, #2 action spec
 {
- \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+ \seq_if_exist:cT { l__pdf_hook_startlink_#1_seq }
+   {
+    \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+   }
  \driver_pdf_startlink_user:nn
   {
-    \prop_map_function:cN
-     { l__pdf_hook_startlink_#1_attr_prop }
-     \__pdf_get_key_value:nn
+   \prop_if_exist:cT { l__pdf_hook_startlink_#1_attr_prop }
+    {
+     \prop_map_function:cN
+      { l__pdf_hook_startlink_#1_attr_prop }
+      \__pdf_get_key_value:nn
+     }
   }
   { #2 }
 }
@@ -381,12 +447,18 @@
 % At second one with the \texttt{goto name} argument:
 \cs_new_protected:Nn \pdf_startlink_goto_name:nn %#1 type, #2 destination
 {
- \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+ \seq_if_exist:cT { l__pdf_hook_startlink_#1_seq }
+   {
+    \seq_use:cn { l__pdf_hook_startlink_#1_seq }{}
+   }
  \driver_pdf_startlink_goto:nn
   {
-    \prop_map_function:cN
-     { l__pdf_hook_startlink_#1_attr_prop }
-     \__pdf_get_key_value:nn
+   \prop_if_exist:cT { l__pdf_hook_startlink_#1_attr_prop }
+     {
+      \prop_map_function:cN
+      { l__pdf_hook_startlink_#1_attr_prop }
+      \__pdf_get_key_value:nn
+     }
   }
   { #2 }
 }
@@ -403,11 +475,15 @@
 \seq_new:N \l__pdf_hook_endlink_run_seq
 \seq_new:N \l__pdf_hook_endlink_file_seq
 \seq_new:N \l__pdf_hook_endlink_link_seq
+\seq_new:N \l__pdf_hook_endlink_menu_seq
 
 \cs_new_protected:Nn \pdf_endlink:n %#1 type, e.g. url
  {
   \driver_pdf_endlink:
-  \seq_use:cn { l__pdf_hook_endlink_#1_seq }{}
+  \seq_if_exist:cT {l__pdf_hook_endlink_#1_seq}
+   {
+    \seq_use:cn { l__pdf_hook_endlink_#1_seq }{}
+   }
  }
 
 %</package>





More information about the latex3-commits mailing list