[latex3-commits] [latex3/tagpdf] multiplestruct: avoid duplicated OBJR (5f91f29)
github at latex-project.org
github at latex-project.org
Sat Jan 13 19:43:25 CET 2024
Repository : https://github.com/latex3/tagpdf
On branch : multiplestruct
Link : https://github.com/latex3/tagpdf/commit/5f91f29b5c99f27659d2a1f8a294f4eca0d577d2
>---------------------------------------------------------------
commit 5f91f29b5c99f27659d2a1f8a294f4eca0d577d2
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat Jan 13 19:43:25 2024 +0100
avoid duplicated OBJR
>---------------------------------------------------------------
5f91f29b5c99f27659d2a1f8a294f4eca0d577d2
tagpdf-struct.dtx | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/tagpdf-struct.dtx b/tagpdf-struct.dtx
index 9276268..50a28b2 100644
--- a/tagpdf-struct.dtx
+++ b/tagpdf-struct.dtx
@@ -285,13 +285,15 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_@@_struct_exist_bool}
+% \begin{variable}{\l_@@_struct_exist_bool,\g_@@_struct_duplicate_prop}
% 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.
+% we need to suppress various parts of the code. We also record the numbers
+% of such duplicated structures (hopefully they won't be many).
% \begin{macrocode}
%<*package>
\bool_new:N\l_@@_struct_exist_bool
+\prop_new:N\g_@@_struct_duplicate_prop
% \end{macrocode}
% \end{variable}
@@ -752,21 +754,27 @@
%<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 }
- {
- /Type/OBJR/Obj~#2/Pg~#3
- }
- \@@_seq_gput_right:ce
- { g_@@_struct_kids_#1_seq }
- {
- \pdf_object_ref_last:
+ \prop_get:NnNF
+ \g_@@_struct_duplicate_prop
+ {#1}
+ \l_@@_tmpa_tl
+ {
+ \pdf_object_unnamed_write:nn
+ { dict }
+ {
+ /Type/OBJR/Obj~#2/Pg~#3
+ }
+ \@@_seq_gput_right:ce
+ { g_@@_struct_kids_#1_seq }
+ {
+ \pdf_object_ref_last:
+ }
+%<debug> \seq_gput_right:ce
+%<debug> { g_@@_struct_debug_kids_#1_seq }
+%<debug> {
+%<debug> OBJR~reference
+%<debug> }
}
-%<debug> \seq_gput_right:ce
-%<debug> { g_@@_struct_debug_kids_#1_seq }
-%<debug> {
-%<debug> OBJR~reference
-%<debug> }
}
%</package|debug>
%<*package>
@@ -1404,6 +1412,10 @@
{ g_@@_struct_\int_eval:n { \c at g_@@_struct_abs_int }_prop }
{
\bool_set_true:N \l_@@_struct_exist_bool
+ \prop_gput:Nee
+ \g_@@_struct_duplicate_prop
+ {\int_use:N \c at g_@@_struct_abs_int}
+ {true}
\typeout{Structure~\the\c at g_@@_struct_abs_int~already~exists} %TODO message
}
\bool_if:NF \l_@@_struct_exist_bool
More information about the latex3-commits
mailing list.