[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: start action dictionaries, new window (9588564)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jan 26 23:47:25 CET 2021


Repository : https://github.com/latex3/pdfresources
On branch  : reworking-annot
Link       : https://github.com/latex3/pdfresources/commit/9588564f2f80cf9c1fb480d5f8ea3f7a9e0d4233

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

commit 9588564f2f80cf9c1fb480d5f8ea3f7a9e0d4233
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jan 26 23:47:25 2021 +0100

    start action dictionaries, new window


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

9588564f2f80cf9c1fb480d5f8ea3f7a9e0d4233
 hyperref-generic.dtx | 87 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 66 insertions(+), 21 deletions(-)

diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index bb9d580..ea188eb 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -272,6 +272,7 @@
 %  \begin{itemize}
 %  \item |debug|, |verbose| (a boolean)
 %  \item |bookmarks| (a boolean)
+%  \item |plainpages|
 %  \end{itemize}
 %
 %  Ignored options:
@@ -1424,6 +1425,10 @@
 % \subsection{URI links}
 %
 %   \begin{macrocode}
+\pdfdict_new:n   {l_hyp/annot/A/URI}
+\pdfdict_put:nnn {l_hyp/annot/A/URI}{Type}{/Action}
+\pdfdict_put:nnn {l_hyp/annot/A/URI}{S}{/URI}
+
 \cs_new_protected:Npn \hyper at linkurl #1 #2  %#1:link text #2: URI,
   {
     \group_begin:
@@ -1431,24 +1436,24 @@
       { #2}
       { \l_@@_text_enc_uri_print_tl }
       \l_@@_uri_tmpa_tl
+    \pdfdict_put:nno{l_hyp/annot/A/URI}{URI}{\l_@@_uri_tmpa_tl}
+    \ifHy at href@ismap
+       \pdfdict_put:nnn{l_hyp/annot/A/URI}{IsMap}{true}
+    \fi
+    \tl_if_empty:NF \Hy at href@nextactionraw
+      {
+        \str_remove_once:Nn \Hy at href@nextactionraw {/Next}
+        \pdfdict_put:nno{l_hyp/annot/A/Next}{\Hy at href@nextactionraw}
+      }
     \cs_set_eq:NN \# \c_hash_str
     \cs_set_eq:NN \% \c_percent_str
     \Hy at safe@activestrue
     \mode_leave_vertical:
-    %Subtype and A could probably also be handled with hooks if needed
-    %but checks for all drivers should be done then.
-    \pdfannot_link:nnn { URI }
+    \pdfannot_link:nxn { URI }
       {
         /A
           <<
-            % the action dictionary has no hook!
-            /Type/Action~
-            /S/URI~
-            /URI\l_@@_uri_tmpa_tl~
-            \ifHy at href@ismap
-              /IsMap~true%
-            \fi
-            \Hy at href@nextactionraw
+            \pdfdict_use:n {l_hyp/annot/A/URI}
           >>
       }
       {
@@ -1461,6 +1466,10 @@
 %    \end{macrocode}
 % \subsection{GoToR Links {files}}
 %    \begin{macrocode}
+\pdfdict_new:n   {l_hyp/annot/A/GoToR}
+\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{Type}{/Action}
+\pdfdict_put:nnn {l_hyp/annot/A/GoToR}{S}{GoToR}
+
 \cs_new_protected:Npn \hyper at linkfile #1 #2 #3 % anchor text, filename, destname
   {
     \group_begin:
@@ -1470,25 +1479,31 @@
       { \l_@@_filename_tmpa_tl }
       { \l_@@_text_enc_file_print_tl }
       \l_@@_filename_tmpa_tl
+    \pdfdict_put:nno {l_hyp/annot/A/GoToR}{F}{\l_@@_filename_tmpa_tl}
     \@@_text_pdfstring:nnN
       { #3 }
       { \l_@@_text_enc_dest_print_tl }
       \l_@@_dest_name_tmpa_tl
+    \tl_if_blank:eTF {#3}
+      {
+        \pdfdict_put:nnx {l_hyp/annot/A/GoToR}{D}
+          {[\Hy at href@page/\l_@@_dest_pdfremotestartview_tl]}
+      }
+      {
+        \pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l_@@_dest_name_tmpa_tl}
+      }
     \Hy at MakeRemoteAction
+    \tl_if_empty:NF \Hy at href@nextactionraw
+      {
+        \str_remove_once:Nn \Hy at href@nextactionraw {/Next}
+        \pdfdict_put:nno{l_hyp/annot/A/Next}{\Hy at href@nextactionraw}
+      }
     \mode_leave_vertical:
-    \pdfannot_link:nnn %expansion??
+    \pdfannot_link:nxn %expansion??
       { GoToR }
       {
         /A<<
-          /F \l_@@_filename_tmpa_tl
-          /S/GoToR
-          \Hy at SetNewWindow
-          \ifx\\#3\\
-            /D[\Hy at href@page/\l_@@_dest_pdfremotestartview_tl]
-          \else
-            /D \l_@@_dest_name_tmpa_tl
-          \fi
-          \Hy at href@nextactionraw
+          \pdfdict_use:n {l_hyp/annot/A/GoToR}
         >>
       }
       {
@@ -1680,6 +1695,11 @@
     \hyper at linklaunch {#1}{#2}{#3}
   }
 
+\pdfdict_new:n   {l_hyp/annot/A/Launch}
+\pdfdict_put:nnn
+  {l_hyp/annot/A/GoToR}
+  {S}{Launch}
+
 \cs_new_protected:Npn \hyper at linklaunch #1 #2 #3 % filename, anchor text, Parameters
  {
   \group_begin:
@@ -1779,6 +1799,15 @@
    ,debug .meta:n = {verbose=#1}
    ,debug .default:n = {true}
  }
+
+\keys_define:nn { hyp / setup }
+  {
+   ,plainpages .choice:
+   ,plainpages / true  .code:n = { \Hy at plainpagestrue}
+   ,plainpages / false .code:n = { \Hy at plainpagesfalse}
+   ,plainpages .default:n = {true}
+  }
+
 \keys_define:nn { hyp / setup }
  {
    ,baseurl       .code:n =
@@ -1936,6 +1965,22 @@
          { pdfmenubar }
          { \exp_not:n {#1} }
      }
+   ,pdfnewwindow .choice:
+   ,pdfnewwindow / true .code:n =
+     {
+       \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{true}
+       \pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{true}
+     }
+   ,pdfnewwindow / false .code:n =
+     {
+       \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{false}
+       \pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{false}
+     }
+   ,pdfnewwindow /  .code:n =
+     {
+       \pdfdict_remove:nn {l_hyp/annot/A/GoToR}{/NewWindow}
+       \pdfdict_remove:nn {l_hyp/annot/A/Launch}{/NewWindow}
+     }
    ,pdfnonfullscreenpagemode   .choices:nn =
      { UseNone, UseOutlines, UseThumbs, FullScreen, UseOC } %pdf 1.5
      {





More information about the latex3-commits mailing list.