[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: destinations, corrections (0e07e30)
Ulrike Fischer
fischer at troubleshooting-tex.de
Sun Jan 3 20:21:06 CET 2021
Repository : https://github.com/latex3/pdfresources
On branch : reworking-annot
Link : https://github.com/latex3/pdfresources/commit/0e07e30859c13b5bcfd0d6b04db12482bfb72ec3
>---------------------------------------------------------------
commit 0e07e30859c13b5bcfd0d6b04db12482bfb72ec3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sun Jan 3 20:21:06 2021 +0100
destinations, corrections
>---------------------------------------------------------------
0e07e30859c13b5bcfd0d6b04db12482bfb72ec3
hyperref-generic.dtx | 86 +++++++++++++++++++++++++++++++---------------------
1 file changed, 51 insertions(+), 35 deletions(-)
diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 7274b0b..03380e1 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -220,13 +220,16 @@
%% \l_@@_tmpa_seq
%% \l_@@_tmpa_box
%% \l_@@_tmpa_tl
-%% \l_@@_destname_tmpa_tl
+%% \l_@@_dest_name_tmpa_tl
%% \l_@@_uri_tmpa_tl
%% \l_@@_filename_tmpa_tl
%% \l_@@_para_tmpa_tl
%% \l_@@_CheckmarkYes_tl
%% \l_@@_CheckmarkOff_tl
%% \l_@@_RadioYes_tl
+%% \l_@@_dest_box_bool
+%%\\l_@@_dest_box
+%% \l_@@_dest_pdfview_tl
%% list of commands which probably will have to change
%% \Hy at EXPsetpdfborder
%% \Hy at EXPsetpdfhighlight
@@ -483,7 +486,7 @@
\box_new:N \l_@@_tmpa_box
\tl_new:N \l_@@_tmpa_tl
\seq_new:N \l_@@_tmpa_seq
-\tl_new:N \l_@@_destname_tmpa_tl %needed?
+\tl_new:N \l_@@_dest_name_tmpa_tl %needed?
\tl_new:N \l_@@_uri_tmpa_tl
\tl_new:N \l_@@_filename_tmpa_tl
\tl_new:N \l_@@_para_tmpa_tl
@@ -493,12 +496,17 @@
\tl_const:Nn \c__hyp_destname_undefined_tl {UNDEFINED}
%variables
-\tl_new:N \g_@@_pdfstartpage_tl
-\tl_new:N \g_@@_pdfstartview_tl
-\tl_new:N \l_@@_pdfremotestartview_tl
+\tl_new:N \g_@@_dest_pdfstartpage_tl
+\tl_new:N \g_@@_dest_pdfstartview_tl
+\tl_new:N \l_@@_dest_pdfremotestartview_tl
+\tl_new:N \l_@@_dest_pdfview_tl
+
+%boxes
+\box_new:N \l_@@_dest_box
% booleans
\bool_new:N \l_@@_tmpa_bool
+\bool_new:N \l_@@_dest_box_bool
%%% pdfa key:
\bool_new:N \l_@@_pdfa_bool
\ifHy at pdfa
@@ -542,7 +550,7 @@
|
(?:(?:FitH|FitV|FitBH|FitBV)(?:\ +(?:\d+|\d*\.\d+)|\ +null){1})
|
- (?:FitR (?:\ +\d+|\d*\.\d+){4})
+ (?:FitR (?:\ +\d+|\ +\d*\.\d+){4}\ )
)
}
@@ -1010,23 +1018,23 @@
\cs_new_protected:Npn \__hyp_link_dest_begin:nw #1
{
\mode_leave_vertical:
- \protected at edef \l_@@_destname_tmpa_tl { #1 }
- \tl_if_empty:NTF \l_@@_destname_tmpa_tl
+ \protected at edef \l_@@_dest_name_tmpa_tl { #1 }
+ \tl_if_empty:NTF \l_@@_dest_name_tmpa_tl
{
\msg_warning:nnx
{ hyp }
{ empty-destination-name }
{ \c__hyp_destname_undefined_tl }
- \tl_set_eq:NN \l_@@_destname_tmpa_tl \c__hyp_destname_undefined_tl
+ \tl_set_eq:NN \l_@@_dest_name_tmpa_tl \c__hyp_destname_undefined_tl
}
{ %I hope this is right ...
- \__hyp_pstringdef:Nx \l_@@_destname_tmpa_tl
+ \__hyp_pstringdef:Nx \l_@@_dest_name_tmpa_tl
{
- \exp_args:No \HyperDestNameFilter { \l_@@_destname_tmpa_tl }
+ \exp_args:No \HyperDestNameFilter { \l_@@_dest_name_tmpa_tl }
}
}
\exp_args:No
- \pdfannot_link_goto_begin:nw { \l_@@_destname_tmpa_tl }
+ \pdfannot_link_goto_begin:nw { \l_@@_dest_name_tmpa_tl }
\Hy at colorlink\@linkcolor
}
@@ -1125,7 +1133,7 @@
\tl_set:Nn \l_@@_filename_tmpa_tl { #2 }
\Hy at CleanupFile \l_@@_filename_tmpa_tl
\__hyp_pstringdef:No \l_@@_filename_tmpa_tl { \l_@@_filename_tmpa_tl }
- \__hyp_pstringdef:Nn \l_@@_destname_tmpa_tl { #3 }
+ \__hyp_pstringdef:Nn \l_@@_dest_name_tmpa_tl { #3 }
\Hy at MakeRemoteAction
\mode_leave_vertical:
\pdfannot_link:nnn %expansion??
@@ -1136,9 +1144,9 @@
/S/GoToR
\Hy at SetNewWindow
\ifx\\#3\\
- /D[\Hy at href@page\l_@@_pdfremotestartview_tl]
+ /D[\Hy at href@page\l_@@_dest_pdfremotestartview_tl]
\else
- /D( \l_@@_destname_tmpa_tl )
+ /D( \l_@@_dest_name_tmpa_tl )
\fi
\Hy at href@nextactionraw
>>
@@ -1630,26 +1638,26 @@
\exp_args:NNV
\regex_extract_once:NnNTF \c_@@_dest_startview_regex \l_@@_tmpa_tl \l_@@_tmpa_seq
{
- \tl_set_Nx \l_@@_pdfremotestartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}}
+ \tl_set:Nx \l_@@_dest_pdfremotestartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}}
}
{
\msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfremotestartview}
- \tl_set:Nn \l_@@_pdfremotestartview_tl {Fit}
+ \tl_set:Nn \l_@@_dest_pdfremotestartview_tl {Fit}
}
}
% pdfstartpage is special as it shares code with pdfstartview
,pdfstartpage .code:n =
{
- \tl_gset:Nx \g_@@_pdfstartpage_tl { #1 }
+ \tl_gset:Nx \g_@@_dest_pdfstartpage_tl { #1 }
\bool_if:nTF
- { \tl_if_empty_p:N \g_@@_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_pdfstartview_tl }
+ { \tl_if_empty_p:N \g_@@_dest_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_dest_pdfstartview_tl }
{
\pdfmanagement_remove:nn {Catalog} { OpenAction }
}
{
\pdfmanagement_add:nnx {Catalog} { OpenAction }
{
- [\pdf_object_pageref:n {\g_@@_pdfstartpage_tl}~/\g_@@_pdfstartview_tl]
+ [\pdf_object_pageref:n {\g_@@_dest_pdfstartpage_tl}~/\g_@@_dest_pdfstartview_tl]
}
}
}
@@ -1660,21 +1668,21 @@
\exp_args:NNV
\regex_extract_once:NnNTF \c_@@_dest_startview_regex \l_@@_tmpa_tl \l_@@_tmpa_seq
{
- \tl_gset:Nx \g_@@_pdfstartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}}
+ \tl_gset:Nx \g_@@_dest_pdfstartview_tl {\seq_item:Nn \l_@@_tmpa_seq {1}}
}
{
\msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfstartview}
- \tl_gset:Nn \g_@@_pdfstartview_tl {Fit}
+ \tl_gset:Nn \g_@@_dest_pdfstartview_tl {Fit}
}
\bool_if:nTF
- { \tl_if_empty_p:N \g_@@_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_pdfstartview_tl }
+ { \tl_if_empty_p:N \g_@@_dest_pdfstartpage_tl || \tl_if_empty_p:N \g_@@_dest_pdfstartview_tl }
{
\pdfmanagement_remove:nn {Catalog} { OpenAction }
}
{
\pdfmanagement_add:nnx {Catalog} { OpenAction }
{
- [\pdf_object_pageref:n {\g_@@_pdfstartpage_tl}~/\g_@@_pdfstartview_tl]
+ [\pdf_object_pageref:n {\g_@@_dest_pdfstartpage_tl}~/\g_@@_dest_pdfstartview_tl]
}
}
}
@@ -1778,17 +1786,14 @@
,pdfwindowui .default:n = true
}
-% Destination keys. A bit more complicated so extra.
-\bool_new:N \l_@@_dest_box_bool
-\box_new:N \l_@@_dest_box
-\tl_new:N \l_@@_dest_pdfview_tl
+% Destination keys. pdfview is a bit more complicated so extra.
\keys_define:nn { hyp / setup }
{
,pdfview .code:n =
{
\bool_set_false:N \l_@@_dest_box_bool
\seq_set_split:Nnn \l_@@_tmpa_seq {~}{#1}
- \str_case_e:nn { \str_lowercase:f{ \seq_item:Nn \l_@@_tmpa_seq {1} } }
+ \str_case_e:nnF { \str_lowercase:f{ \seq_item:Nn \l_@@_tmpa_seq {1} } }
{
{ xyz }
{
@@ -1831,18 +1836,25 @@
\bool_set_true:N \l_@@_dest_box_bool
\hbox_set_to_wd:Nnn \l_@@_dest_box
{
- \int_abs:n
+ \fp_eval:n
{
- \seq_item:Nn\l_@@_tmpa_seq{4}
- -
- (\seq_item:Nn\l_@@_tmpa_seq{2})
+ round
+ (
+ abs
+ (
+ \seq_item:Nn\l_@@_tmpa_seq{4}
+ -
+ (\seq_item:Nn\l_@@_tmpa_seq{2})
+ ),
+ 3
+ )
}bp
}{}
\box_set_dp:Nn \l_@@_dest_box
{
- \int_eval:n
+ \fp_eval:n
{
- 0 - (\seq_item:Nn\l_@@_tmpa_seq{3})
+ round(0 - (\seq_item:Nn\l_@@_tmpa_seq{3}),3)
}bp
}
\box_set_ht:Nn \l_@@_dest_box
@@ -1852,6 +1864,10 @@
}
}
}
+ {
+ \msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfview}
+ \tl_set:Nn \l_@@_dest_pdfview_tl {fit}
+ }
}
,pdfview .initial:n = {xyz}
}
More information about the latex3-commits
mailing list.