[latex3-commits] [latex3/tagpdf] multiplestruct: handle multiple typesetting better (5fb169d)
github at latex-project.org
github at latex-project.org
Sat Jan 13 16:57:45 CET 2024
Repository : https://github.com/latex3/tagpdf
On branch : multiplestruct
Link : https://github.com/latex3/tagpdf/commit/5fb169da88473dcc4eb0ab29d733037f07f1f0a5
>---------------------------------------------------------------
commit 5fb169da88473dcc4eb0ab29d733037f07f1f0a5
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat Jan 13 16:57:45 2024 +0100
handle multiple typesetting better
>---------------------------------------------------------------
5fb169da88473dcc4eb0ab29d733037f07f1f0a5
tagpdf-struct.dtx | 55 ++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 40 insertions(+), 15 deletions(-)
diff --git a/tagpdf-struct.dtx b/tagpdf-struct.dtx
index 4808ccc..9276268 100644
--- a/tagpdf-struct.dtx
+++ b/tagpdf-struct.dtx
@@ -284,6 +284,17 @@
%<base>\int_gzero:N \c at g_@@_struct_abs_int
% \end{macrocode}
% \end{variable}
+%
+% \begin{variable}{\l_@@_struct_exist_bool}
+% if the structure number already exists (e.g. because
+% the counter is reset after measuring phases)
+% we need to suppress various parts of the code.
+% \begin{macrocode}
+%<*package>
+\bool_new:N\l_@@_struct_exist_bool
+% \end{macrocode}
+% \end{variable}
+
%
% \begin{variable}{\g_@@_struct_objR_seq}
% a sequence to store mapping between the
@@ -292,7 +303,6 @@
% consecutively and so the index of the seq can be used.
% A seq allows easy mapping over the structures.
% \begin{macrocode}
-%<*package>
\@@_seq_new:N \g_@@_struct_objR_seq
% \end{macrocode}
% \end{variable}
@@ -1385,20 +1395,32 @@
%<package>\@@_check_if_active_struct:T
%<debug>\@@_check_if_active_struct:TF
{
+% \end{macrocode}
+% we use \cs{stepcounter} so that it can catch code that reset counters.
+% \begin{macrocode}
+ \stepcounter{ g_@@_struct_abs_int }
\group_begin:
- \int_gincr:N \c at g_@@_struct_abs_int
- \@@_prop_new:c { g_@@_struct_\int_eval:n { \c at g_@@_struct_abs_int }_prop }
+ \prop_if_exist:cT
+ { g_@@_struct_\int_eval:n { \c at g_@@_struct_abs_int }_prop }
+ {
+ \bool_set_true:N \l_@@_struct_exist_bool
+ \typeout{Structure~\the\c at g_@@_struct_abs_int~already~exists} %TODO message
+ }
+ \bool_if:NF \l_@@_struct_exist_bool
+ {
+ \@@_prop_new:c { g_@@_struct_\int_eval:n { \c at g_@@_struct_abs_int }_prop }
%<debug> \prop_new:c { g_@@_struct_debug_\int_eval:n {\c at g_@@_struct_abs_int}_prop }
- \@@_new_output_prop_handler:n {\int_eval:n { \c at g_@@_struct_abs_int }}
- \@@_seq_new:c { g_@@_struct_kids_\int_eval:n { \c at g_@@_struct_abs_int }_seq}
+ \@@_new_output_prop_handler:n {\int_eval:n { \c at g_@@_struct_abs_int }}
+ \@@_seq_new:c { g_@@_struct_kids_\int_eval:n { \c at g_@@_struct_abs_int }_seq}
%<debug> \seq_new:c { g_@@_struct_debug_kids_\int_eval:n {\c at g_@@_struct_abs_int}_seq }
- \exp_args:Ne
- \pdf_object_new:n
- { @@/struct/\int_eval:n { \c at g_@@_struct_abs_int } }
- \@@_struct_prop_gput:nnn
- { \int_use:N \c at g_@@_struct_abs_int }
- { Type }
- { /StructElem }
+ \exp_args:Ne
+ \pdf_object_new:n
+ { @@/struct/\int_eval:n { \c at g_@@_struct_abs_int } }
+ \@@_struct_prop_gput:nnn
+ { \int_use:N \c at g_@@_struct_abs_int }
+ { Type }
+ { /StructElem }
+ }
\tl_set:Nn \l_@@_struct_stack_parent_tmpa_tl {-1}
\keys_set:nn { @@ / struct} { #1 }
% \end{macrocode}
@@ -1539,9 +1561,12 @@
%record this structure as kid:
%\tl_show:N \g_@@_struct_stack_current_tl
%\tl_show:N \l_@@_struct_stack_parent_tmpa_tl
- \@@_struct_kid_struct_gput_right:ee
- { \l_@@_struct_stack_parent_tmpa_tl }
- { \g_@@_struct_stack_current_tl }
+ \bool_if:NF \l_@@_struct_exist_bool
+ {
+ \@@_struct_kid_struct_gput_right:ee
+ { \l_@@_struct_stack_parent_tmpa_tl }
+ { \g_@@_struct_stack_current_tl }
+ }
%\prop_show:c { g_@@_struct_\g_@@_struct_stack_current_tl _prop }
%\seq_show:c {g_@@_struct_kids_\l_@@_struct_stack_parent_tmpa_tl _seq}
}
More information about the latex3-commits
mailing list.