[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: adapted driver to new hook commands, started to convert ref links (ffa8abe)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Mar 17 01:08:15 CET 2019


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

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

commit ffa8abeaa413420ab0d452f374b47f928685f88e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Mar 17 01:08:15 2019 +0100

    adapted driver to new hook commands, started to convert ref links


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

ffa8abeaa413420ab0d452f374b47f928685f88e
 hluatex-experimental.def |  136 +++++++++++++++++++++++++++++++---------------
 test-pdfresources.tex    |    8 ++-
 test-tagpdf-link.tex     |   12 +++-
 3 files changed, 108 insertions(+), 48 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 1f347f6..afc6feb 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -15,61 +15,84 @@
 \ExplSyntaxOn
 \def\Hy at EXPsetpdfborder
  {
- \clist_map_inline:nn { url , file , run }
+ \clist_map_inline:nn { url , file , run , link}
    {
-    \ifx\@pdfborder\@empty
-     \pdf_startlink_remove_attr:nn { ##1  } { /Border }
-    \else
-     \pdf_startlink_add_attr:nnn { ##1 }
-     { /Border }
-     { [\@pdfborder] }
-    \fi
-    \ifx\@pdfborderstyle\@empty
-     \pdf_startlink_remove_attr:nn { ##1 } { /BS }
-    \else
-     \pdf_startlink_add_attr:nnn { ##1}
-     { /BS }
-     { <<\@pdfborderstyle>> }
-    \fi
+    \tl_if_empty:NTF \@pdfborder
+     {
+      \hook_remove:nnn { pdf } { startlink_##1_attr } { /Border }
+     }
+     {
+      \hook_put:nnnn
+       { pdf }
+       { startlink_##1_attr }
+       { /Border }
+       { [\@pdfborder] }
+     }
+    \tl_if_empty:NTF \@pdfborderstyle
+     {
+      \hook_remove:nnn  { pdf }{ startlink_##1_attr } { /BS }
+     }
+     {
+      \hook_put:nnnn
+      { pdf }
+      { startlink_##1_attr }
+      { /BS }
+      { <<\@pdfborderstyle>> }
+     }
    }
  }
 
 \def\Hy at EXPsetpdfhighlight
  {
-  \clist_map_inline:nn { url , file , run }
+  \clist_map_inline:nn { url , file , run , link}
    {
-    \ifx\@pdfhighlight\@empty
-     \pdf_startlink_remove_attr:nn { ##1 }{ /H }
-   \else
-     \pdf_startlink_add_attr:nnn  { ##1 }
-     { /H }
-     { \@pdfhighlight }
-  \fi
+    \tl_if_empty:NTF \@pdfhighlight
+     {
+      \hook_remove:nnn { pdf } { startlink_##1_attr }{ /H }
+     }
+     {
+      \hook_put:nnnn
+      { pdf }
+      { startlink_##1_attr }
+      { /H }
+      { \@pdfhighlight }
+     }
   }
  }
 
 \def\Hy at EXPseturlbordercolor
   {
-   \ifx\@urlbordercolor\relax
-     \pdf_startlink_remove_attr:nn { url }{ /C }
-   \else
-     \pdf_startlink_add_attr:nnn { url }
-      { /C }
-      { [\@urlbordercolor] }
-   \fi
+   \cs_if_exist:NTF\@urlbordercolor
+   {
+    \hook_put:nnnn
+     { pdf }
+     { startlink_url_attr }
+     { /C }
+     { [\@urlbordercolor] }
+   }
+   {
+    \hook_remove:nnn { pdf } { startlink_url_attr } { /C }
+   }
   }
 
 \def\Hy at EXPsetfilebordercolor
   {
-   \ifx\@filebordercolor\relax
-     \pdf_startlink_remove_attr:nn { file }{ /C }
-   \else
-     \pdf_startlink_add_attr:nnn { file }
+   \cs_if_exist:NTF \@filebordercolor
+    {
+     \hook_put:nnnn
+      { pdf }
+      { startlink_file_attr }
       { /C }
       { [\@filebordercolor] }
-   \fi
+    }
+    {
+     \hook_remove:nnn { pdf } { startlink_file_attr }{ /C }
+    }
   }
 
+\ifHy at pdfa
+ \hook_put:nnnn { pdf } { startlink_link_attr }{ /F } { 4 }
+\fi
 % for now we are updating the attribute manually after \hypersetup
 % some better method must be found
 \NewDocumentCommand\hypupdateattribute { }
@@ -429,27 +452,34 @@
     }%
   \fi
   \Hy at StartlinkName{%
-    \ifHy at pdfa /F 4\fi
-    \Hy at setpdfborder
-    \Hy at setpdfhighlight
-    \ifx\CurrentBorderColor\relax
-    \else
-      /C[\CurrentBorderColor]%
-    \fi
+    %\ifHy at pdfa /F 4\fi
+%    \Hy at setpdfborder
+%    \Hy at setpdfhighlight
+%    \ifx\CurrentBorderColor\relax
+%    \else
+%      /C[\CurrentBorderColor]%
+%    \fi
   }\Hy at testname
   \expandafter\Hy at colorlink\csname @#1color\endcsname
 }
+
+\ExplSyntaxOn
 \def\Hy at StartlinkName#1#2{%
-  \pdfstartlink attr{#1}goto name{#2}\relax
+  \pdf_startlink_goto_name:nn { link } { #2 }
 }
 
-\ExplSyntaxOn
+
 \def\close at EXPpdflink#1{%
   \Hy at endcolorlink
   \Hy at VerboseLinkStop
   \pdf_endlink:n { #1 }
 }
 
+\def\close at pdflink{%
+  \Hy at endcolorlink
+  \Hy at VerboseLinkStop
+  \pdfendlink
+}
 \ExplSyntaxOff
 \def\hyper at anchor#1{%
   \new at pdflink{#1}\anchor at spot\pdf at endanchor
@@ -472,8 +502,24 @@
   \find at pdflink{#1}{#2}%
 }
 \def\hyper at linkend{\close at pdflink}
+\ExplSyntaxOn
 \def\hyper at link#1#2#3{%
   \Hy at VerboseLinkStart{#1}{#2}%
+  \tl_if_exist:cTF
+   { @#1bordercolor }
+   {
+    \hook_put:nnnn
+     { pdf }
+     { startlink_link_attr }
+     { /C }{ [\tl_use:c { @#1bordercolor }] } %do I need to expand??
+   }
+   {
+    \hook_remove:nnn
+     { pdf }
+     { startlink_link_attr }
+     { /C }
+   }
+   \prop_show:N\l__pdf_hook_startlink_link_attr_prop
   \ltx at IfUndefined{@#1bordercolor}{%
     \let\CurrentBorderColor\relax
   }{%
@@ -482,6 +528,8 @@
   \find at pdflink{#1}{#2}#3\Hy at xspace@end
   \close at pdflink
 }
+\ExplSyntaxOff
+
 \let\CurrentBorderColor\@linkbordercolor
 \ExplSyntaxOn
 \def\hyper at linkurl#1#2{%
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index 42cbdf2..e11a314 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -17,12 +17,16 @@
 \driver_pdf_compresslevel:n {0}
 \driver_pdf_objects_disable:
 \ExplSyntaxOff
-
+\usepackage{xcolor}
 \usepackage[customdriver=hluatex-experimental]{hyperref}
-\hypersetup{urlcolor=red,pdfborder={1 1 1}}
+\hypersetup{urlcolor=blue,linkbordercolor=blue,pdfborder={1 1 1}}
+\makeatletter 
 \hypupdateattribute
 \makeatletter 
 \begin{document}
+\section{a}\label{a}
+\tracingmacros=1 \ref{a}
+\end{document}
 %test driver link.
 \url{www.blub.de}
 
diff --git a/test-tagpdf-link.tex b/test-tagpdf-link.tex
index f2e23b9..3812a43 100644
--- a/test-tagpdf-link.tex
+++ b/test-tagpdf-link.tex
@@ -42,8 +42,16 @@
 
 %add hooks:
 \ExplSyntaxOn\makeatletter
-\pdf_startlink_add_attr:nnn {url}{/StructParent}{\int_use:N\c at g__uftag_parenttree_obj_int}
-\seq_put_right:Nn \l__pdf_endlink_url_hook_seq {\__uftag_struct_finish_link:}
+\hook_put:nnnn 
+ { pdf } 
+ { startlink_url_attr }
+ { /StructParent }
+ { \int_use:N\c at g__uftag_parenttree_obj_int }
+\hook_put_right:nnn 
+ { pdf }
+ { endlink_url } 
+ { \__uftag_struct_finish_link: }
+
 \ExplSyntaxOff
 \begin{document}
 \tagstructbegin{tag=Document}





More information about the latex3-commits mailing list