[latex3-commits] [git/LaTeX3-latex3-pdfresources] master: rewrote hyper at linklaunch (2d49dae)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon Mar 23 00:29:41 CET 2020


Repository : https://github.com/latex3/pdfresources
On branch  : master
Link       : https://github.com/latex3/pdfresources/commit/2d49dae42bd1e991bedc7eb733d79013a1fb819c

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

commit 2d49dae42bd1e991bedc7eb733d79013a1fb819c
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon Mar 23 00:29:41 2020 +0100

    rewrote hyper at linklaunch


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

2d49dae42bd1e991bedc7eb733d79013a1fb819c
 hgeneric-experimental.def | 49 +++++++++++++++++++++++++++++------------------
 hyperreflinktypes.tex     | 17 +++++++++++++---
 2 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index d357284..7ce4090 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -26,6 +26,7 @@
 %% \l__hyp_destname_tmpa_tl
 %% \l__hyp_uri_tmpa_tl
 %% \l__hyp_filename_tmpa_tl
+%% \l__hyp_para_tmpa_tl
 %% \l__hyp_CheckmarkYes_tl
 %% \l__hyp_CheckmarkOff_tl
 %% \l__hyp_RadioYes_tl
@@ -114,7 +115,7 @@
 \tl_new:N  \l__hyp_destname_tmpa_tl %needed?
 \tl_new:N  \l__hyp_uri_tmpa_tl
 \tl_new:N  \l__hyp_filename_tmpa_tl
-
+\tl_new:N  \l__hyp_para_tmpa_tl
 % const
 \tl_const:Nn \c__hyp_destname_undefined_tl {UNDEFINED}
 
@@ -675,40 +676,50 @@
       }
     \group_end:
   }
-\ExplSyntaxOff
 
-\ExplSyntaxOn
 % use by run links xxxxxxxxxxx
+%define \hyper at linklaunch for naming consistency
 \use:x
   { % filename, anchor text, linkname
     \cs_set_protected:Npn \exp_not:N \@hyper at launch run \c_colon_str ##1 \exp_not:N \\ ##2 ##3
   }
-%\def\@hyper at launch run:#1\\#2#3 % filename, anchor text linkname
+  {
+    \hyper at linklaunch {#1}{#2}{#3}
+  }
+
+\cs_new_protected:Npn \hyper at linklaunch #1 #2 #3 % filename, anchor text, Parameters
  {
   \group_begin:
-    \Hy at pstringdef\Hy at pstringF{#1}%
-    \Hy at pstringdef\Hy at pstringP{#3}%
+    \__hyp_pstringdef:Nn \l__hyp_filename_tmpa_tl { #1 }
+    \__hyp_pstringdef:Nn \l__hyp_para_tmpa_tl     { #3 }
+    %\Hy at pstringdef\Hy at pstringF{#1}%
+    %\Hy at pstringdef\Hy at pstringP{#3}%
     \mode_leave_vertical:
-    \pdf_link_user:nnn
+    \pdf_link_user:nnn %expansion?
      { run }
      {
-      /Subtype /Link
-      /A<<
-          /F(\Hy at pstringF)
+       /Subtype /Link
+       /A<<
+          /F( \l__hyp_filename_tmpa_tl )
           /S/Launch
           \Hy at SetNewWindow
-          \ifx\\#3\\
-          \else
-            /Win<</P(\Hy at pstringP)/F(\Hy at pstringF)>>
-          \fi
+          \bool_if:nF
+            {
+              \tl_if_empty_p:N \l__hyp_para_tmpa_tl
+              ||
+              \pdf_version_compare_p:Nn > {1.9}
+            }
+            {
+              /Win<</P(\l__hyp_para_tmpa_tl)/F(\l__hyp_filename_tmpa_tl)>>
+            }
           \Hy at href@nextactionraw
-        >>
+         >>
       }
       {
-       \Hy at colorlink
-        \@runcolor#2\Hy at xspace@end
-       \Hy at endcolorlink
-       \Hy at VerboseLinkStop
+        \Hy at colorlink\@runcolor
+        #2\Hy at xspace@end
+        \Hy at endcolorlink
+        \Hy at VerboseLinkStop
       }
   \group_end:
 }
diff --git a/hyperreflinktypes.tex b/hyperreflinktypes.tex
index 0a56469..0ca0b3a 100644
--- a/hyperreflinktypes.tex
+++ b/hyperreflinktypes.tex
@@ -67,16 +67,17 @@ All places in the code where \ifHy at nesting is used are about anchors, not links.
 It is unclear if nesting can be used, and what use it would have.
 
 %%% external links
+%
 \hyper at linkurl:
 2 arguments: #1 the link text, #2 the URI
 defined in the driver
 used in hyperref inside
- \@hyper at launch run
+ \@hyper at launch run %not really as \@hyper at launch is redefined
  \url@
  \@hyper at readexternallink
  \@hyper at linkfile file
 
-
+%
  \hyper at linkfile
  3 arguments: anchor text, filename, destination inside the target
  (the destination is the text after a #: \href{blub.pdf#destination})
@@ -85,5 +86,15 @@ used in hyperref inside
  \@hyper at linkfile file:#1\\#2#3#4
  creates a GoToR action, so only used if the target is a pdf
  hyperref checks if the file ends with pdf (\XR at ext) or has no extentions.
-
  (true: \Hy at IfStringEndsWith{xyz.abc}{abc}{yes}{no}) 
+ 
+ % 
+ \@hyper at launch run:#1\\#2#3
+ defined both in hyperref and in the drivers.
+ has a delimited argument. The orginal definition in hyperref is based on
+ \hyper at linkurl, the definition in the drivers seems to be an extension.
+ used in \@hyper at readexternallink.
+ For naming consistency it would make sense to define a \hyper at linklaunch which is used by 
+ \@hyper at launch. 
+ See for syntax https://tex.stackexchange.com/a/245098/2388
+ 
\ No newline at end of file





More information about the latex3-commits mailing list.