summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-21 20:54:17 +0000
committerKarl Berry <karl@freefriends.org>2019-03-21 20:54:17 +0000
commit5dac6ccc074f72d03d874ffcf70ddc2a9b0db096 (patch)
tree734fb9bc1b5b369899803efdb7886a7563f3677c /Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
parentfd57fc78450f5089af3e89bdb28023e17ea181fd (diff)
tagpdf (21mar19)
git-svn-id: svn://tug.org/texlive/trunk@50509 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty90
1 files changed, 84 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
index c6da45cd34c..27106c12c59 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
@@ -1,4 +1,4 @@
-\ProvidesExplPackage {tagpdf-struct-code} {2019/01/04} {0.50}
+\ProvidesExplPackage {tagpdf-struct-code} {2019/03/20} {0.60}
{part of tagpdf - code related to storing structure}
% I will use a latex counter for the structure count
@@ -159,6 +159,35 @@
}
}
+\cs_new:Nn\__uftag_struct_kid_link_gput_right:nn %#1 num of parent struct, #2 obj number of link
+ {
+ \__uftag_pdfobj:Nn \l__uftag_tmpa_tl
+ {
+ <<
+ /Type \c_space_tl /OBJR \c_space_tl
+ /Obj \c_space_tl #2 \c_space_tl 0 \c_space_tl R
+ >>
+ }
+ \__uftag_seq_gput_right:cx
+ { g__uftag_struct_kids_#1_seq }
+ {
+ \l__uftag_tmpa_tl \c_space_tl 0 \c_space_tl R
+ }
+ }
+
+\cs_generate_variant:Nn\__uftag_struct_kid_link_gput_right:nn { nx}
+
+\cs_new:Nn\__uftag_struct_exchange_kid_command:N %N= seq
+ {
+ \seq_gpop_left:NN #1 \l_tmpa_tl
+ \regex_replace_once:nnN
+ {\c{\__uftag_mc_insert_mcid_kids:n}}
+ {\c{\__uftag_mc_insert_mcid_single_kids:n}}
+ \l_tmpa_tl
+ \seq_gput_left:NV #1 \l_tmpa_tl
+ }
+\cs_generate_variant:Nn\__uftag_struct_exchange_kid_command:N { c }
+
\cs_new:Nn \__uftag_struct_fill_kid_key:n %#1 is the struct num
{
\int_case:nnF
@@ -173,6 +202,12 @@
{ } %no kids, do nothing
{ 1 } % 1 kid, insert
{
+ % in this case we in luamode need a special command in luamode to get the array right. See issue #13
+ \bool_if:NT\g__uftag_mode_lua_bool
+ {
+ \__uftag_struct_exchange_kid_command:c
+ {g__uftag_struct_kids_\prop_item:cn{ g__uftag_struct_#1_prop }{num}_seq}
+ }
\__uftag_prop_gput:cnx { g__uftag_struct_#1_prop } {K}
{
\seq_item:cn
@@ -190,7 +225,9 @@
{
g__uftag_struct_kids_\prop_item:cn{ g__uftag_struct_#1_prop }{num}_seq
}
- {\c_space_tl}
+ {
+ \c_space_tl
+ }
]
}
}
@@ -338,7 +375,7 @@
}
-\cs_new:Nn \uftag_struct_begin:n
+\cs_new_protected:Nn \uftag_struct_begin:n
{
\group_begin:
\int_gincr:N \c@g__uftag_struct_abs_int
@@ -402,13 +439,16 @@
\group_end:
}
-\cs_new:Nn \uftag_struct_end:
+\cs_new_protected:Nn \uftag_struct_end:
{%take the current structure num from the stack:
%the objects are written later, lua mode hasn't all needed info yet
%\seq_show:N \g__uftag_struct_stack_seq
\seq_gpop:NNTF \g__uftag_struct_stack_seq \l_tmpa_tl
{
- \__uftag_check_info_closing_struct:o { \g__uftag_struct_stack_current_tl }
+ \int_compare:nNnT {\l__uftag_loglevel_int} > { 0 }
+ {
+ \__uftag_check_info_closing_struct:o { \g__uftag_struct_stack_current_tl }
+ }
}
{ \__uftag_check_no_open_struck: }
% get the previous one, shouldn't be empty as the root should be there
@@ -421,7 +461,7 @@
}
}
-\cs_new:Nn \uftag_struct_use:n %#1 is the label
+\cs_new_protected:Nn \uftag_struct_use:n %#1 is the label
{
\prop_if_exist:cTF
{ g__uftag_struct_\zref@extractdefault{tagpdfstruct-#1}{tagstruct}{unknown}_prop } %??????????
@@ -442,4 +482,42 @@
{\msg_warning:nnn{uftag}{struct-label-unknown}{#1}}
}
+
+%%%% Code to tag links
+%%%% this works for url, see exp-link.pdf.
+%%%% it must be checked for other links
+
+\cs_new_protected:Nn \__uftag_struct_finish_link:
+{
+ \bool_if:NT \g_uftag_active_struct_bool
+ {
+ %get the number of the parent link structure:
+ \seq_get:NNF
+ \g__uftag_struct_stack_seq
+ \l__uftag_struct_stack_parent_tmp_tl
+ {
+ \msg_error:nn { uftag } { struct-faulty-nesting }
+ }
+ %put the obj number of link annot in the kid entry:
+ \__uftag_struct_kid_link_gput_right:nx
+ {
+ \l__uftag_struct_stack_parent_tmp_tl
+ }
+ {
+ \int_use:N\__uftag_pdf_lastlink:
+ }
+ % add the parent obj number to the parent tree:
+ \__uftag_parenttree_add_objr:nn
+ {
+ \int_use:N\c@g__uftag_parenttree_obj_int
+ }
+ {
+ \prop_item:cn{ g__uftag_struct_\l__uftag_struct_stack_parent_tmp_tl _prop }
+ { objnum }
+ }
+ % increase the int:
+ \stepcounter{ g__uftag_parenttree_obj_int }
+ }
+}
+
\endinput