summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-09-01 03:01:08 +0000
committerNorbert Preining <norbert@preining.info>2023-09-01 03:01:08 +0000
commita6340ee3ba0294ecd24259d39642d27d804187b2 (patch)
treecc82e5c3e6d1b796a6f2a530aea279ff238b556c /macros/latex/contrib/tagpdf/tagpdf-struct.dtx
parent7cda3a1cc32bd43dab837e2b73046dab2aeaec98 (diff)
CTAN sync 202309010301
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-struct.dtx')
-rw-r--r--macros/latex/contrib/tagpdf/tagpdf-struct.dtx111
1 files changed, 92 insertions, 19 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
index 0b175aa4f1..9e5fbe7fa6 100644
--- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
+++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
@@ -46,7 +46,7 @@
% }^^A
% }
%
-% \date{Version 0.98k, released 2023-08-04}
+% \date{Version 0.98l, released 2023-08-30}
% \maketitle
% \begin{documentation}
% \section{Public Commands}
@@ -247,7 +247,7 @@
% \begin{macrocode}
%<@@=tag>
%<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2023-08-04} {0.98k}
+\ProvidesExplPackage {tagpdf-struct-code} {2023-08-30} {0.98l}
{part of tagpdf - code related to storing structure}
%</header>
% \end{macrocode}
@@ -508,7 +508,16 @@
{ g_@@_struct_0_prop }
{ parentrole }
{ {StructTreeRoot}{pdf} }
-
+%</package>
+%<*debug>
+\prop_new:c { g_@@_struct_debug_0_prop }
+\prop_gset_eq:cc
+ { g_@@_struct_debug_0_prop }
+ { g_@@_struct_0_prop }
+\prop_gremove:cn { g_@@_struct_debug_0_prop }{Namespaces}
+\seq_new:c { g_@@_struct_debug_kids_0_seq }
+%</debug>
+%<*package>
% \end{macrocode}
% Namespaces are pdf 2.0.
% If the code moves into the kernel, the setting must be probably delayed.
@@ -573,7 +582,7 @@
{ \l_@@_get_tmpc_tl } %
}
}
- }
+ }
\cs_generate_variant:Nn \@@_struct_set_tag_info:nnn {eVV}
% \end{macrocode}
% \end{macro}
@@ -626,23 +635,30 @@
/MCID \c_space_tl \@@_ref_value:enn{mcid-#1}{tagmcid}{1}
>>
}
+%</package>
% \end{macrocode}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
+%<*package|debug>
+%<package>\cs_new_protected:Npn \@@_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
+%<debug>\cs_set_protected:Npn \@@_struct_kid_mc_gput_right:nn #1 #2 %#1 structure num, #2 MCID absnum%
{
\@@_seq_gput_right:cx
{ g_@@_struct_kids_#1_seq }
{
\@@_struct_mcid_dict:n {#2}
}
+%<debug> \seq_gput_right:cn
+%<debug> { g_@@_struct_debug_kids_#1_seq }
+%<debug> {
+%<debug> MC~#2
+%<debug> }
\@@_seq_gput_right:cn
{ g_@@_struct_kids_#1_seq }
{
\prop_item:Nn \g_@@_struct_cont_mc_prop {#2}
}
}
-\cs_generate_variant:Nn \@@_struct_kid_mc_gput_right:nn {nx}
-
+%<package>\cs_generate_variant:Nn \@@_struct_kid_mc_gput_right:nn {nx}
% \end{macrocode}
% \end{macro}
% \begin{macro}
@@ -652,16 +668,22 @@
% This commands adds a structure as kid. We only need to record the object
% reference in the sequence.
% \begin{macrocode}
-\cs_new_protected:Npn\@@_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct
+%<package>\cs_new_protected:Npn\@@_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct
+%<debug>\cs_set_protected:Npn\@@_struct_kid_struct_gput_right:nn #1 #2 %#1 num of parent struct, #2 kid struct
{
\@@_seq_gput_right:cx
{ g_@@_struct_kids_#1_seq }
{
\pdf_object_ref:n { @@/struct/#2 }
}
- }
+%<debug> \seq_gput_right:cn
+%<debug> { g_@@_struct_debug_kids_#1_seq }
+%<debug> {
+%<debug> Struct~#2
+%<debug> }
+ }
-\cs_generate_variant:Nn \@@_struct_kid_struct_gput_right:nn {xx}
+%<package>\cs_generate_variant:Nn \@@_struct_kid_struct_gput_right:nn {xx}
% \end{macrocode}
% \end{macro}
% \begin{macro}
@@ -672,9 +694,10 @@
% object reference
%
% \begin{macrocode}
-\cs_new_protected:Npn\@@_struct_kid_OBJR_gput_right:nnn #1 #2 #3 %#1 num of parent struct,
- %#2 obj reference
- %#3 page object reference
+%<package>\cs_new_protected:Npn\@@_struct_kid_OBJR_gput_right:nnn #1 #2 #3 %#1 num of parent struct,
+%<package> %#2 obj reference
+%<package> %#3 page object reference
+%<debug>\cs_set_protected:Npn\@@_struct_kid_OBJR_gput_right:nnn #1 #2 #3
{
\pdf_object_unnamed_write:nn
{ dict }
@@ -686,10 +709,15 @@
{
\pdf_object_ref_last:
}
+%<debug> \seq_gput_right:cx
+%<debug> { g_@@_struct_debug_kids_#1_seq }
+%<debug> {
+%<debug> OBJR~reference
+%<debug> }
}
-
+%</package|debug>
+%<*package>
\cs_generate_variant:Nn\@@_struct_kid_OBJR_gput_right:nnn { xxx }
-
% \end{macrocode}
% \end{macro}
% \begin{macro}
@@ -1319,8 +1347,10 @@
\group_begin:
\int_gincr:N \c@g_@@_struct_abs_int
\@@_prop_new:c { g_@@_struct_\int_eval:n { \c@g_@@_struct_abs_int }_prop }
+%<debug> \prop_new:c { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
\@@_new_output_prop_handler:n {\int_eval:n { \c@g_@@_struct_abs_int }}
\@@_seq_new:c { g_@@_struct_kids_\int_eval:n { \c@g_@@_struct_abs_int }_seq}
+%<debug> \seq_new:c { g_@@_struct_debug_kids_\int_eval:n {\c@g_@@_struct_abs_int}_seq }
\exp_args:Ne
\pdf_object_new:n
{ @@/struct/\int_eval:n { \c@g_@@_struct_abs_int } }
@@ -1461,6 +1491,8 @@
{
\pdf_object_ref:e { @@/struct/\l_@@_struct_stack_parent_tmpa_tl }
}
+% \end{macrocode}
+% \begin{macrocode}
%record this structure as kid:
%\tl_show:N \g_@@_struct_stack_current_tl
%\tl_show:N \l_@@_struct_stack_parent_tmpa_tl
@@ -1470,6 +1502,30 @@
%\prop_show:c { g_@@_struct_\g_@@_struct_stack_current_tl _prop }
%\seq_show:c {g_@@_struct_kids_\l_@@_struct_stack_parent_tmpa_tl _seq}
}
+% \end{macrocode}
+% the debug mode stores in second prop and replaces value with more suitable ones.
+% This must be done outside of the stash boolean.
+% \begin{macrocode}
+%<debug> \prop_gset_eq:cc
+%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
+%<debug> { g_@@_struct_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
+%<debug> \prop_gput:cnx
+%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
+%<debug> { P }
+%<debug> {
+%<debug> \bool_if:NTF \l_@@_struct_elem_stash_bool
+%<debug> {no~parent:~stashed}
+%<debug> {
+%<debug> parent~structure:~\l_@@_struct_stack_parent_tmpa_tl\c_space_tl =~
+%<debug> \l_@@_get_parent_tmpa_tl
+%<debug> }
+%<debug> }
+%<debug> \prop_gput:cnx
+%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
+%<debug> { NS }
+%<debug> { \g_@@_struct_tag_NS_tl }
+% \end{macrocode}
+% \begin{macrocode}
%\prop_show:c { g_@@_struct_\g_@@_struct_stack_current_tl _prop }
%\seq_show:c {g_@@_struct_kids_\l_@@_struct_stack_parent_tmpa_tl _seq}
%<debug> \@@_debug_struct_begin_insert:n { #1 }
@@ -1526,7 +1582,7 @@
% TODO: decide how it should be guarded. Probably by the struct-check.
% \begin{macrocode}
%<base>\cs_new_protected:Npn \tag_struct_use:n #1 {}
-%<*package>
+%<*package|debug>
\cs_set_protected:Npn \tag_struct_use:n #1 %#1 is the label
{
\@@_check_if_active_struct:T
@@ -1547,6 +1603,23 @@
\pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl }
}
% \end{macrocode}
+% debug code
+% \begin{macrocode}
+%<debug> \prop_gset_eq:cc
+%<debug> { g_@@_struct_debug_\@@_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
+%<debug> { g_@@_struct_\@@_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
+%<debug> \prop_gput:cnx
+%<debug> { g_@@_struct_debug_\@@_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
+%<debug> { P }
+%<debug> {
+%<debug> parent~structure:~\g_@@_struct_stack_current_tl\c_space_tl=~
+%<debug> \g_@@_struct_tag_tl
+%<debug> }
+%<debug> \prop_gput:cnx
+%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
+%<debug> { NS }
+%<debug> { \g_@@_struct_tag_NS_tl }
+% \end{macrocode}
% check if the tag is allowed as child. Here we have to retrieve the
% tag info for the child, while the data for the parent is in
% the global tl-vars:
@@ -1572,14 +1645,14 @@
{ \int_eval:n {\c@g_@@_struct_abs_int} }
\g_@@_struct_tag_tl
\g_@@_struct_tag_NS_tl
- }
+ }
}
{
\msg_warning:nnn{ tag }{struct-label-unknown}{#1}
}
}
}
-%</package>
+%</package|debug>
% \end{macrocode}
% \end{macro}
% \begin{macro}{\tag_struct_use_num:n}
@@ -1740,7 +1813,7 @@
% \section{Attributes and attribute classes}
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2023-08-04} {0.98k}
+\ProvidesExplPackage {tagpdf-attr-code} {2023-08-30} {0.98l}
{part of tagpdf - code related to attributes and attribute classes}
%</header>
% \end{macrocode}