| 1 |
%% |
| 2 |
%% This is file `tagpdf-debug.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% tagpdf.dtx (with options: `debug') |
| 8 |
%% tagpdf-checks.dtx (with options: `debug') |
| 9 |
%% tagpdf-user.dtx (with options: `debug') |
| 10 |
%% tagpdf-mc-shared.dtx (with options: `debug') |
| 11 |
%% tagpdf-tree.dtx (with options: `debug') |
| 12 |
%% tagpdf-roles.dtx (with options: `debug') |
| 13 |
%% tagpdf-struct.dtx (with options: `debug') |
| 14 |
%% tagpdf-space.dtx (with options: `debug') |
| 15 |
%% |
| 16 |
%% Copyright (C) 2019-2025 Ulrike Fischer |
| 17 |
%% |
| 18 |
%% It may be distributed and/or modified under the conditions of |
| 19 |
%% the LaTeX Project Public License (LPPL), either version 1.3c of |
| 20 |
%% this license or (at your option) any later version. The latest |
| 21 |
%% version of this license is in the file: |
| 22 |
%% |
| 23 |
%% https://www.latex-project.org/lppl.txt |
| 24 |
%% |
| 25 |
%% This file is part of the "tagpdf bundle" (The Work in LPPL) |
| 26 |
%% and all files in that bundle must be distributed together. |
| 27 |
%% |
| 28 |
%% File: tagpdf.dtx |
| 29 |
\ProvidesExplPackage {tagpdf-debug} {2026-05-17} {1.0c} |
| 30 |
{ debug code for tagpdf } |
| 31 |
\@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} |
| 32 |
\prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} |
| 33 |
\prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG} |
| 34 |
\cs_set_protected:Npn \tag_stop: |
| 35 |
{ |
| 36 |
\msg_note:nne {tag / debug }{tag-suspend}{ \int_use:N \l__tag_tag_stop_int } |
| 37 |
\int_incr:N \l__tag_tag_stop_int |
| 38 |
\bool_set_false:N \l__tag_active_struct_bool |
| 39 |
\bool_set_false:N \l__tag_active_mc_bool |
| 40 |
\bool_set_false:N \l__tag_active_socket_bool |
| 41 |
\__tag_stop_para_ints: |
| 42 |
} |
| 43 |
\cs_set_protected:Npn \tag_start: |
| 44 |
{ |
| 45 |
\int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int } |
| 46 |
\int_if_zero:nT { \l__tag_tag_stop_int } |
| 47 |
{ |
| 48 |
\bool_set_true:N \l__tag_active_struct_bool |
| 49 |
\bool_set_true:N \l__tag_active_mc_bool |
| 50 |
\bool_set_true:N \l__tag_active_socket_bool |
| 51 |
\__tag_start_para_ints: |
| 52 |
} |
| 53 |
\msg_note:nne {tag / debug }{tag-resume}{ \int_use:N \l__tag_tag_stop_int } |
| 54 |
} |
| 55 |
\cs_set_eq:NN\tagstop\tag_stop: |
| 56 |
\cs_set_eq:NN\tagstart\tag_start: |
| 57 |
\cs_set_protected:Npn \tag_suspend:n #1 |
| 58 |
{ |
| 59 |
\msg_note:nnee {tag / debug }{tag-suspend} |
| 60 |
{ \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}} |
| 61 |
\int_incr:N \l__tag_tag_stop_int |
| 62 |
\bool_set_false:N \l__tag_active_struct_bool |
| 63 |
\bool_set_false:N \l__tag_active_mc_bool |
| 64 |
\bool_set_false:N \l__tag_active_socket_bool |
| 65 |
\__tag_stop_para_ints: |
| 66 |
} |
| 67 |
\cs_set_eq:NN \tag_stop:n \tag_suspend:n |
| 68 |
\cs_set_protected:Npn \tag_resume:n #1 |
| 69 |
{ |
| 70 |
\int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int } |
| 71 |
\int_if_zero:nT { \l__tag_tag_stop_int } |
| 72 |
{ |
| 73 |
\bool_set_true:N \l__tag_active_struct_bool |
| 74 |
\bool_set_true:N \l__tag_active_mc_bool |
| 75 |
\bool_set_true:N \l__tag_active_socket_bool |
| 76 |
\__tag_start_para_ints: |
| 77 |
} |
| 78 |
\msg_note:nnee {tag / debug }{tag-resume} |
| 79 |
{ \int_use:N \l__tag_tag_stop_int }{\exp_not:n{#1}} |
| 80 |
} |
| 81 |
\cs_set_eq:NN \tag_start:n \tag_resume:n |
| 82 |
\bool_if:NTF \g__tag_mode_lua_bool |
| 83 |
{ |
| 84 |
\RequirePackage {tagpdf-debug-lua} |
| 85 |
} |
| 86 |
{ |
| 87 |
\RequirePackage {tagpdf-debug-generic} % |
| 88 |
} |
| 89 |
%% File: tagpdf-checks.dtx |
| 90 |
|
| 91 |
|
| 92 |
\msg_new:nnn { tag/debug } { show-struct } |
| 93 |
{ |
| 94 |
=========================\\ |
| 95 |
The~structure~#1~ |
| 96 |
\tl_if_empty:nTF {#2} |
| 97 |
{ is~empty \\>~ . } |
| 98 |
{ contains: #2 } |
| 99 |
\\ |
| 100 |
} |
| 101 |
\msg_new:nnn { tag/debug } { show-kids } |
| 102 |
{ |
| 103 |
The~structure~has~the~following~kids: |
| 104 |
\tl_if_empty:nTF {#2} |
| 105 |
{ \\>~ NONE } |
| 106 |
{ #2 } |
| 107 |
\\ |
| 108 |
========================= |
| 109 |
} |
| 110 |
\msg_new:nnn { tag / debug } {mc-begin} { MC~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] } |
| 111 |
\msg_new:nnn { tag / debug } {mc-end} { MC~end~#1~[\msg_line_context:] } |
| 112 |
|
| 113 |
\cs_new_protected:Npn \__tag_debug_mc_begin_insert:n #1 |
| 114 |
{ |
| 115 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 116 |
{ |
| 117 |
\msg_note:nnnn { tag / debug } {mc-begin} {inserted} { #1 } |
| 118 |
} |
| 119 |
} |
| 120 |
\cs_new_protected:Npn \__tag_debug_mc_begin_ignore:n #1 |
| 121 |
{ |
| 122 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 123 |
{ |
| 124 |
\msg_note:nnnn { tag / debug } {mc-begin } {ignored} { #1 } |
| 125 |
} |
| 126 |
} |
| 127 |
\cs_new_protected:Npn \__tag_debug_mc_end_insert: |
| 128 |
{ |
| 129 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 130 |
{ |
| 131 |
\msg_note:nnn { tag / debug } {mc-end} {inserted} |
| 132 |
} |
| 133 |
} |
| 134 |
\cs_new_protected:Npn \__tag_debug_mc_end_ignore: |
| 135 |
{ |
| 136 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 137 |
{ |
| 138 |
\msg_note:nnn { tag / debug } {mc-end } {ignored} |
| 139 |
} |
| 140 |
} |
| 141 |
\msg_new:nnn { tag / debug } {struct-begin} |
| 142 |
{ |
| 143 |
Struct~\tag_get:n{struct_num}~begin~#1~with~options:~\tl_to_str:n{#2}~\\[\msg_line_context:] |
| 144 |
} |
| 145 |
\msg_new:nnn { tag / debug } {struct-end} |
| 146 |
{ |
| 147 |
Struct~end~#1~[\msg_line_context:] |
| 148 |
} |
| 149 |
\msg_new:nnn { tag / debug } {struct-end-wrong} |
| 150 |
{ |
| 151 |
Struct~end~'#1'~doesn't~fit~start~'#2'~[\msg_line_context:] |
| 152 |
} |
| 153 |
|
| 154 |
\cs_new_protected:Npn \__tag_debug_struct_begin_insert:n #1 |
| 155 |
{ |
| 156 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 157 |
{ |
| 158 |
\msg_note:nnnn { tag / debug } {struct-begin} {inserted} { #1 } |
| 159 |
\seq_log:N \g__tag_struct_tag_stack_seq |
| 160 |
} |
| 161 |
} |
| 162 |
\cs_new_protected:Npn \__tag_debug_struct_begin_ignore:n #1 |
| 163 |
{ |
| 164 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 165 |
{ |
| 166 |
\msg_note:nnnn { tag / debug } {struct-begin } {ignored} { #1 } |
| 167 |
} |
| 168 |
} |
| 169 |
\cs_new_protected:Npn \__tag_debug_struct_end_insert: |
| 170 |
{ |
| 171 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 172 |
{ |
| 173 |
\msg_note:nnn { tag / debug } {struct-end} {inserted} |
| 174 |
\seq_log:N \g__tag_struct_tag_stack_seq |
| 175 |
} |
| 176 |
} |
| 177 |
\cs_new_protected:Npn \__tag_debug_struct_end_ignore: |
| 178 |
{ |
| 179 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 180 |
{ |
| 181 |
\msg_note:nnn { tag / debug } {struct-end } {ignored} |
| 182 |
} |
| 183 |
} |
| 184 |
\cs_new_protected:Npn \__tag_debug_struct_end_check:n #1 |
| 185 |
{ |
| 186 |
\int_compare:nNnT { \l__tag_loglevel_int } > {0} |
| 187 |
{ |
| 188 |
\seq_get:NNT \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl |
| 189 |
{ |
| 190 |
\str_if_eq:eeF |
| 191 |
{#1} |
| 192 |
{\exp_last_unbraced:No \use_i:nn { \l__tag_tmpa_tl }} |
| 193 |
{ |
| 194 |
\msg_warning:nnee { tag/debug }{ struct-end-wrong } |
| 195 |
{#1} |
| 196 |
{\exp_last_unbraced:No \use_i:nn { \l__tag_tmpa_tl }} |
| 197 |
} |
| 198 |
} |
| 199 |
} |
| 200 |
} |
| 201 |
\msg_new:nnn { tag / debug } {tag-suspend} |
| 202 |
{ |
| 203 |
\int_if_zero:nTF |
| 204 |
{#1} |
| 205 |
{Tagging~suspended} |
| 206 |
{Tagging~(not)~suspended~(already~inactive)}\\ |
| 207 |
level:~#1~==>~\int_eval:n{#1+1}\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:] |
| 208 |
} |
| 209 |
\msg_new:nnn { tag / debug } {tag-resume} |
| 210 |
{ |
| 211 |
\int_if_zero:nTF |
| 212 |
{#1} |
| 213 |
{Tagging~resumed} |
| 214 |
{Tagging~(not)~resumed}\\ |
| 215 |
level:~\int_eval:n{#1+1}~==>~#1\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:] |
| 216 |
} |
| 217 |
%% File: tagpdf-user.dtx |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
\keys_define:nn { __tag / show } |
| 223 |
{ |
| 224 |
,debug/structures .code:n = |
| 225 |
{ |
| 226 |
\int_step_inline:nnn{#1}{\c@g__tag_struct_abs_int} |
| 227 |
{ |
| 228 |
\msg_term:nneeee |
| 229 |
{ tag/debug } { show-struct } |
| 230 |
{ ##1 } |
| 231 |
{ |
| 232 |
\prop_map_function:cN |
| 233 |
{g__tag_struct_debug_##1_prop} |
| 234 |
\msg_show_item_unbraced:nn |
| 235 |
} |
| 236 |
{ } { } |
| 237 |
\msg_term:nneeee |
| 238 |
{ tag/debug } { show-kids } |
| 239 |
{ ##1 } |
| 240 |
{ |
| 241 |
\seq_map_function:cN |
| 242 |
{g__tag_struct_debug_kids_##1_seq} |
| 243 |
\msg_show_item_unbraced:n |
| 244 |
} |
| 245 |
{ } { } |
| 246 |
} |
| 247 |
} |
| 248 |
,debug/structures .default:n = 1 |
| 249 |
} |
| 250 |
%% File: tagpdf-mc-shared.dtx |
| 251 |
%% File: tagpdf-tree.dtx |
| 252 |
%% File: tagpdf-roles.dtx |
| 253 |
%% File: tagpdf-struct.dtx |
| 254 |
|
| 255 |
\cs_set_protected:Npn \__tag_struct_prop_gput:nnn #1 #2 #3 |
| 256 |
{ |
| 257 |
\__tag_prop_gput:cnn |
| 258 |
{ g__tag_struct_#1_prop }{#2}{#3} |
| 259 |
\prop_gput:cnn { g__tag_struct_debug_#1_prop } {#2} {#3} |
| 260 |
} |
| 261 |
\cs_generate_variant:Nn \__tag_struct_prop_gput:nnn {onn,nne,nee,nno} |
| 262 |
|
| 263 |
\prop_new:c { g__tag_struct_debug_1_prop } |
| 264 |
\seq_new:c { g__tag_struct_debug_kids_1_seq } |
| 265 |
\prop_gset_eq:cc { g__tag_struct_debug_1_prop }{ g__tag_struct_1_prop } |
| 266 |
\prop_gremove:cn { g__tag_struct_debug_1_prop }{Namespaces} |
| 267 |
\cs_set_protected:Npn \__tag_struct_kid_mc_gput_right:nn #1 #2 |
| 268 |
{ |
| 269 |
\__tag_seq_gput_right:ce |
| 270 |
{ g__tag_struct_kids_#1_seq } |
| 271 |
{ |
| 272 |
\__tag_struct_mcid_dict:n {#2} |
| 273 |
} |
| 274 |
\seq_gput_right:cn |
| 275 |
{ g__tag_struct_debug_kids_#1_seq } |
| 276 |
{ |
| 277 |
MC~#2 |
| 278 |
} |
| 279 |
\__tag_seq_gput_right:cn |
| 280 |
{ g__tag_struct_kids_#1_seq } |
| 281 |
{ |
| 282 |
\prop_item:Nn \g__tag_struct_cont_mc_prop {#2} |
| 283 |
} |
| 284 |
} |
| 285 |
\cs_set_protected:Npn\__tag_struct_kid_struct_gput_right:nn #1 #2 |
| 286 |
%%#1 num of parent struct, #2 kid struct |
| 287 |
{ |
| 288 |
\__tag_seq_gput_right:ce |
| 289 |
{ g__tag_struct_kids_#1_seq } |
| 290 |
{ |
| 291 |
\pdf_object_ref_indexed:nn { __tag/struct }{ #2 } |
| 292 |
} |
| 293 |
\seq_gput_right:cn |
| 294 |
{ g__tag_struct_debug_kids_#1_seq } |
| 295 |
{ |
| 296 |
Struct~#2 |
| 297 |
} |
| 298 |
} |
| 299 |
\cs_set_protected:Npn\__tag_struct_kid_struct_gput_left:nn #1 #2 |
| 300 |
%%#1 num of parent struct, #2 kid struct |
| 301 |
{ |
| 302 |
\__tag_seq_gput_left:ce |
| 303 |
{ g__tag_struct_kids_#1_seq } |
| 304 |
{ |
| 305 |
\pdf_object_ref_indexed:nn { __tag/struct }{ #2 } |
| 306 |
} |
| 307 |
\seq_gput_left:cn |
| 308 |
{ g__tag_struct_debug_kids_#1_seq } |
| 309 |
{ |
| 310 |
Struct~#2 |
| 311 |
} |
| 312 |
} |
| 313 |
\cs_set_protected:Npn\__tag_struct_kid_OBJR_gput_right:nnn #1 #2 #3 |
| 314 |
%%#1 num of parent struct,#2 obj reference,#3 page object reference |
| 315 |
{ |
| 316 |
\pdf_object_unnamed_write:nn |
| 317 |
{ dict } |
| 318 |
{ |
| 319 |
/Type/OBJR/Obj~#2/Pg~#3 |
| 320 |
} |
| 321 |
\__tag_seq_gput_right:ce |
| 322 |
{ g__tag_struct_kids_#1_seq } |
| 323 |
{ |
| 324 |
\pdf_object_ref_last: |
| 325 |
} |
| 326 |
\seq_gput_right:ce |
| 327 |
{ g__tag_struct_debug_kids_#1_seq } |
| 328 |
{ |
| 329 |
OBJR~reference |
| 330 |
} |
| 331 |
} |
| 332 |
\cs_set_protected:Npn \tag_struct_begin:n #1 %#1 key-val |
| 333 |
{ |
| 334 |
\__tag_check_if_active_struct:TF |
| 335 |
{ |
| 336 |
\group_begin: |
| 337 |
\int_gincr:N \c@g__tag_struct_abs_int |
| 338 |
\__tag_prop_new:c { g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop } |
| 339 |
\prop_new:c { g__tag_struct_debug_\int_eval:n {\c@g__tag_struct_abs_int}_prop } |
| 340 |
\__tag_seq_new:c { g__tag_struct_kids_\int_eval:n { \c@g__tag_struct_abs_int }_seq} |
| 341 |
\seq_new:c { g__tag_struct_debug_kids_\int_eval:n {\c@g__tag_struct_abs_int}_seq } |
| 342 |
\pdf_object_new_indexed:nn { __tag/struct } |
| 343 |
{ \c@g__tag_struct_abs_int } |
| 344 |
\__tag_struct_prop_gput:nnn |
| 345 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 346 |
{ Type } |
| 347 |
{ /StructElem } |
| 348 |
\tl_if_empty:NF \l__tag_struct_lang_tl |
| 349 |
{ |
| 350 |
\__tag_struct_prop_gput:nne |
| 351 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 352 |
{ Lang } |
| 353 |
{ (\l__tag_struct_lang_tl) } |
| 354 |
} |
| 355 |
\__tag_struct_prop_gput:nnn |
| 356 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 357 |
{ Type } |
| 358 |
{ /StructElem } |
| 359 |
|
| 360 |
\tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1} |
| 361 |
\keys_set:nn { __tag / struct} { #1 } |
| 362 |
\__tag_struct_set_tag_info:eoo |
| 363 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 364 |
{ \g__tag_struct_tag_tl } |
| 365 |
{ \g__tag_struct_tag_NS_tl } |
| 366 |
\__tag_check_structure_has_tag:n { \int_use:N \c@g__tag_struct_abs_int } |
| 367 |
\int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 } |
| 368 |
{ |
| 369 |
\seq_get:NNF |
| 370 |
\g__tag_struct_stack_seq |
| 371 |
\l__tag_struct_stack_parent_tmpa_tl |
| 372 |
{ |
| 373 |
\msg_error:nn { tag } { struct-faulty-nesting } |
| 374 |
} |
| 375 |
} |
| 376 |
\seq_gpush:NV \g__tag_struct_stack_seq \c@g__tag_struct_abs_int |
| 377 |
\__tag_role_get:ooNN |
| 378 |
{ \g__tag_struct_tag_tl } |
| 379 |
{ \g__tag_struct_tag_NS_tl } |
| 380 |
\l__tag_struct_roletag_tl |
| 381 |
\l__tag_struct_roletag_NS_tl |
| 382 |
\seq_gpush:Ne \g__tag_struct_tag_stack_seq |
| 383 |
{{\g__tag_struct_tag_tl}{\l__tag_struct_roletag_tl}} |
| 384 |
\seq_gpush:Ne \g__tag_struct_roletag_stack_seq |
| 385 |
{\l__tag_struct_roletag_tl} |
| 386 |
\tl_gset:NV \g__tag_struct_stack_current_tl \c@g__tag_struct_abs_int |
| 387 |
\__tag_struct_set_attribute: |
| 388 |
%\seq_show:N \g__tag_struct_stack_seq |
| 389 |
\__tag_struct_prop_gput:nne |
| 390 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 391 |
{ rolemap } |
| 392 |
{ |
| 393 |
{\l__tag_struct_roletag_tl}{\l__tag_struct_roletag_NS_tl} |
| 394 |
} |
| 395 |
\str_case:onTF { \l__tag_struct_roletag_tl } |
| 396 |
{ |
| 397 |
{Part} {} |
| 398 |
{Div} {} |
| 399 |
{NonStruct} {} |
| 400 |
} |
| 401 |
{ |
| 402 |
\bool_if:NTF \l__tag_struct_elem_stash_bool |
| 403 |
{ |
| 404 |
\__tag_struct_prop_gput:nne |
| 405 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 406 |
{ parentrole } |
| 407 |
{ |
| 408 |
{\l__tag_struct_parenttag_tl}{\l__tag_struct_parenttag_NS_tl} |
| 409 |
} |
| 410 |
} |
| 411 |
{ |
| 412 |
\prop_get:cnNT |
| 413 |
{ g__tag_struct_ \l__tag_struct_stack_parent_tmpa_tl _prop } |
| 414 |
{ parentrole } |
| 415 |
\l__tag_get_tmpc_tl |
| 416 |
{ |
| 417 |
\__tag_struct_prop_gput:nno |
| 418 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 419 |
{ parentrole } |
| 420 |
{ |
| 421 |
\l__tag_get_tmpc_tl |
| 422 |
} |
| 423 |
} |
| 424 |
} |
| 425 |
} |
| 426 |
{ |
| 427 |
\__tag_struct_prop_gput:nne |
| 428 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 429 |
{ parentrole } |
| 430 |
{ |
| 431 |
{\l__tag_struct_roletag_tl}{\l__tag_struct_roletag_NS_tl} |
| 432 |
} |
| 433 |
} |
| 434 |
\bool_if:NF |
| 435 |
\l__tag_struct_elem_stash_bool |
| 436 |
{ |
| 437 |
\socket_use:nn{tag/check/parent-child} |
| 438 |
{ |
| 439 |
\__tag_struct_check_parent_child:oo |
| 440 |
{ \l__tag_struct_stack_parent_tmpa_tl } |
| 441 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 442 |
} |
| 443 |
\__tag_struct_prop_gput:nne |
| 444 |
{ \int_use:N \c@g__tag_struct_abs_int } |
| 445 |
{ parentnum } |
| 446 |
{ |
| 447 |
\l__tag_struct_stack_parent_tmpa_tl |
| 448 |
} |
| 449 |
%record this structure as kid: |
| 450 |
%\tl_show:N \g__tag_struct_stack_current_tl |
| 451 |
%\tl_show:N \l__tag_struct_stack_parent_tmpa_tl |
| 452 |
\use:c { __tag_struct_kid_struct_gput_ \l__tag_struct_addkid_tl :ee } |
| 453 |
{ \l__tag_struct_stack_parent_tmpa_tl } |
| 454 |
{ \g__tag_struct_stack_current_tl } |
| 455 |
%\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop } |
| 456 |
%\seq_show:c {g__tag_struct_kids_\l__tag_struct_stack_parent_tmpa_tl _seq} |
| 457 |
} |
| 458 |
\prop_gset_eq:cc |
| 459 |
{ g__tag_struct_debug_\int_eval:n {\c@g__tag_struct_abs_int}_prop } |
| 460 |
{ g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop } |
| 461 |
\prop_gput:cne |
| 462 |
{ g__tag_struct_debug_\int_eval:n {\c@g__tag_struct_abs_int}_prop } |
| 463 |
{ parentnum } |
| 464 |
{ |
| 465 |
\bool_if:NTF \l__tag_struct_elem_stash_bool |
| 466 |
{no~parent:~stashed} |
| 467 |
{ |
| 468 |
\l__tag_struct_stack_parent_tmpa_tl\c_space_tl =~ |
| 469 |
\prop_item:cn{ g__tag_struct_\l__tag_struct_stack_parent_tmpa_tl _prop }{S} |
| 470 |
} |
| 471 |
} |
| 472 |
\prop_gput:cne |
| 473 |
{ g__tag_struct_debug_\int_eval:n {\c@g__tag_struct_abs_int}_prop } |
| 474 |
{ NS } |
| 475 |
{ \g__tag_struct_tag_NS_tl } |
| 476 |
%\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop } |
| 477 |
%\seq_show:c {g__tag_struct_kids_\l__tag_struct_stack_parent_tmpa_tl _seq} |
| 478 |
\__tag_debug_struct_begin_insert:n { #1 } |
| 479 |
\group_end: |
| 480 |
} |
| 481 |
{ \__tag_debug_struct_begin_ignore:n { #1 }} |
| 482 |
} |
| 483 |
\cs_set_protected:Nn \tag_struct_end: |
| 484 |
{ %take the current structure num from the stack: |
| 485 |
%the objects are written later, lua mode hasn't all needed info yet |
| 486 |
%\seq_show:N \g__tag_struct_stack_seq |
| 487 |
\__tag_check_if_active_struct:TF |
| 488 |
{ |
| 489 |
\seq_gpop:NN \g__tag_struct_roletag_stack_seq \l__tag_tmpa_tl |
| 490 |
\seq_gpop:NN \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl |
| 491 |
\seq_gpop:NNTF \g__tag_struct_stack_seq \l__tag_tmpa_tl |
| 492 |
{ |
| 493 |
\__tag_check_info_closing_struct:o { \g__tag_struct_stack_current_tl } |
| 494 |
} |
| 495 |
{ \__tag_check_no_open_struct: } |
| 496 |
% get the previous one, shouldn't be empty as the root should be there |
| 497 |
\seq_get:NNTF \g__tag_struct_stack_seq \l__tag_tmpa_tl |
| 498 |
{ |
| 499 |
\tl_gset:No \g__tag_struct_stack_current_tl { \l__tag_tmpa_tl } |
| 500 |
\__tag_struct_set_attribute: |
| 501 |
} |
| 502 |
{ |
| 503 |
\__tag_check_no_open_struct: |
| 504 |
} |
| 505 |
\seq_get:NNT \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl |
| 506 |
{ |
| 507 |
\tl_gset:Ne \g__tag_struct_tag_tl |
| 508 |
{ \exp_last_unbraced:No\use_i:nn { \l__tag_tmpa_tl } } |
| 509 |
\prop_get:NoNT\g__tag_role_tags_NS_prop { \g__tag_struct_tag_tl} \l__tag_tmpa_tl |
| 510 |
{ |
| 511 |
\tl_gset:Ne \g__tag_struct_tag_NS_tl { \l__tag_tmpa_tl } |
| 512 |
} |
| 513 |
} |
| 514 |
\__tag_debug_struct_end_insert: |
| 515 |
} |
| 516 |
{\__tag_debug_struct_end_ignore:} |
| 517 |
} |
| 518 |
|
| 519 |
\cs_set_protected:Npn \tag_struct_end:n #1 |
| 520 |
{ |
| 521 |
\__tag_check_if_active_struct:T{\__tag_debug_struct_end_check:n{#1}} |
| 522 |
\tag_struct_end: |
| 523 |
} |
| 524 |
\cs_set_protected:Npn \tag_struct_use:n #1 %#1 is the label |
| 525 |
{ |
| 526 |
\__tag_check_if_active_struct:T |
| 527 |
{ |
| 528 |
\prop_if_exist:cTF |
| 529 |
{ g__tag_struct_\property_ref:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop } % |
| 530 |
{ |
| 531 |
\__tag_check_struct_used:n {#1} |
| 532 |
\tl_set:Ne \l__tag_get_child_tmpa_tl |
| 533 |
{ \property_ref:enn{tagpdfstruct-#1}{tagstruct}{1} } |
| 534 |
\__tag_struct_kid_struct_gput_right:ee |
| 535 |
{ \g__tag_struct_stack_current_tl } |
| 536 |
{ \l__tag_get_child_tmpa_tl } |
| 537 |
\__tag_prop_gput:cne |
| 538 |
{ g__tag_struct_ \l__tag_get_child_tmpa_tl _prop } |
| 539 |
{ parentnum } |
| 540 |
{ |
| 541 |
\g__tag_struct_stack_current_tl |
| 542 |
} |
| 543 |
\prop_gput:cne |
| 544 |
{ g__tag_struct_debug_ \l__tag_get_child_tmpa_tl _prop } |
| 545 |
{ parentnum } |
| 546 |
{ |
| 547 |
\g__tag_struct_stack_current_tl\c_space_tl=~ |
| 548 |
\g__tag_struct_tag_tl |
| 549 |
} |
| 550 |
\socket_use:nn{tag/check/parent-child} |
| 551 |
{ |
| 552 |
\__tag_struct_use_check_parent_child:oo |
| 553 |
{ \g__tag_struct_stack_current_tl } |
| 554 |
{ \l__tag_get_child_tmpa_tl } |
| 555 |
} |
| 556 |
} |
| 557 |
{ |
| 558 |
\msg_warning:nnn{ tag }{struct-label-unknown}{#1} |
| 559 |
} |
| 560 |
} |
| 561 |
} |
| 562 |
\cs_set_protected:Npn \tag_struct_use_num:n #1 %#1 is structure number |
| 563 |
{ |
| 564 |
\__tag_check_if_active_struct:T |
| 565 |
{ |
| 566 |
\prop_if_exist:cTF |
| 567 |
{ g__tag_struct_#1_prop } % |
| 568 |
{ |
| 569 |
\prop_get:cnNT |
| 570 |
{g__tag_struct_#1_prop} |
| 571 |
{parentnum} |
| 572 |
\l__tag_tmpa_tl |
| 573 |
{ |
| 574 |
\msg_warning:nnn { tag } {struct-used-twice} {#1} |
| 575 |
} |
| 576 |
\__tag_struct_kid_struct_gput_right:ee |
| 577 |
{ \g__tag_struct_stack_current_tl } |
| 578 |
{ #1 } |
| 579 |
\__tag_struct_prop_gput:nne |
| 580 |
{ #1 } |
| 581 |
{ parentnum } |
| 582 |
{ |
| 583 |
\g__tag_struct_stack_current_tl |
| 584 |
} |
| 585 |
\prop_gput:cne |
| 586 |
{ g__tag_struct_debug_#1_prop } |
| 587 |
{ parentnum } |
| 588 |
{ |
| 589 |
\g__tag_struct_stack_current_tl\c_space_tl=~ |
| 590 |
\g__tag_struct_tag_tl |
| 591 |
} |
| 592 |
\socket_use:nn{tag/check/parent-child} |
| 593 |
{ |
| 594 |
\__tag_struct_use_check_parent_child:oo |
| 595 |
{\g__tag_struct_stack_current_tl} |
| 596 |
{#1} |
| 597 |
} |
| 598 |
} |
| 599 |
{ |
| 600 |
\msg_warning:nnn{ tag }{struct-label-unknown}{#1} |
| 601 |
} |
| 602 |
} |
| 603 |
} |
| 604 |
\cs_generate_variant:Nn\tag_struct_use_num:n {o} |
| 605 |
|
| 606 |
%% File: tagpdf-space.dtx |
| 607 |
%% |
| 608 |
%% |
| 609 |
%% End of file `tagpdf-debug.sty'. |