diff options
author | Karl Berry <karl@freefriends.org> | 2022-08-07 21:41:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-08-07 21:41:10 +0000 |
commit | bbb49faf7bc85d0ced66a0569a720854fb95c4f6 (patch) | |
tree | d2cc54ede15491b2aebe5f35f5b380a35dadda45 /Master/texmf-dist/tex | |
parent | d59d5606e922a9c49072e4be7250eb81a4b919c5 (diff) |
tagpdf (7aug22)
git-svn-id: svn://tug.org/texlive/trunk@64070 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
9 files changed, 233 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty index 47c86e8af40..bd1fab006a3 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty @@ -9,6 +9,7 @@ %% tagpdf-mc-shared.dtx (with options: `base') %% tagpdf-struct.dtx (with options: `base') %% tagpdf-checks.dtx (with options: `base') +%% tagpdf-user.dtx (with options: `base') %% %% Copyright (C) 2019-2022 Ulrike Fischer %% @@ -23,7 +24,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-base} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf-base} {2022-08-06} {0.96} {part of tagpdf - provide base, no-op versions of the user commands } \AddToHook{begindocument} { @@ -36,6 +37,12 @@ \cs_new_protected:Npn \__tag_whatsits: {\tex_special:D {} } } } + +\cs_new_protected:Npn \tag_stop:{} +\cs_new_protected:Npn \tag_start:{} +\cs_new_protected:Npn \tag_stop:n{} +\cs_new_protected:Npn \tag_start:n{} + %% File: tagpdf-mc-generic.dtx \cs_new_protected:Npn \tag_mc_begin:n #1 { \__tag_whatsits: } \cs_new_protected:Nn \tag_mc_end:{ \__tag_whatsits: } @@ -50,9 +57,11 @@ %% File: tagpdf-struct.dtx \newcounter { g__tag_struct_abs_int } \int_gzero:N \c@g__tag_struct_abs_int +\tl_new:N \g__tag_struct_stack_current_tl +\tl_gset:Nn \g__tag_struct_stack_current_tl {\int_use:N\c@g__tag_struct_abs_int} \cs_new:Npn \__tag_get_data_struct_num: { - \int_use:N\c@g__tag_struct_abs_int + \g__tag_struct_stack_current_tl } \cs_new_protected:Npn \tag_struct_begin:n #1 {\int_gincr:N \c@g__tag_struct_abs_int} \cs_new_protected:Npn \tag_struct_end:{} @@ -62,6 +71,42 @@ \cs_new:Npn \tag_get:n #1 { \use:c {__tag_get_data_#1: } } \prg_new_conditional:Npnn \tag_if_active: { p , T , TF, F } { \prg_return_false: } +%% File: tagpdf-user.dtx + + +\NewDocumentCommand \tagpdfsetup { m }{} + +\NewDocumentCommand \tagmcbegin { m } + { + \tag_mc_begin:n {#1} + } + +\NewDocumentCommand \tagmcend { } + { + \tag_mc_end: + } + +\NewDocumentCommand \tagmcuse { m } + { + \tag_mc_use:n {#1} + } + +\NewDocumentCommand \tagstructbegin { m } + { + \tag_struct_begin:n {#1} + } + +\NewDocumentCommand \tagstructend { } + { + \tag_struct_end: + } + +\NewDocumentCommand \tagstructuse { m } + { + \tag_struct_use:n {#1} + } +\newcommand\tagpdfparaOn {} +\newcommand\tagpdfparaOff{} %% %% %% End of file `tagpdf-base.sty'. diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty index 83ddd4026e9..472f34c02f3 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-debug-generic} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf-debug-generic} {2022-08-06} {0.96} {part of tagpdf - debugging code related to marking chunks - generic mode} \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty index d45ca7df58d..113d6e5c0c3 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty @@ -26,12 +26,13 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf-debug} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf-debug} {2022-08-06} {0.96} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} - \end{macrocode} \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} \prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG} + + \bool_if:NTF \g__tag_mode_lua_bool { \RequirePackage {tagpdf-debug-lua} @@ -73,7 +74,7 @@ } \msg_new:nnn { tag / debug } {struct-begin} { - Struct~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] + Struct~\tag_get:n{struct_num}~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] } \msg_new:nnn { tag / debug } {struct-end} { @@ -113,6 +114,8 @@ %% File: tagpdf-user.dtx + + %% File: tagpdf-mc-shared.dtx %% File: tagpdf-tree.dtx @@ -135,6 +138,7 @@ { g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop } { Type } { /StructElem } + \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1} \keys_set:nn { __tag / struct} { #1 } \__tag_check_structure_has_tag:n { \int_eval:n {\c@g__tag_struct_abs_int} } \tl_if_empty:NF @@ -142,13 +146,15 @@ { \__tag_ref_label:en{tagpdfstruct-\l__tag_struct_key_label_tl}{struct} } - %get the potential parent from the stack: - \seq_get:NNF - \g__tag_struct_stack_seq - \l__tag_struct_stack_parent_tmpa_tl + \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 } { - \msg_error:nn { tag } { struct-faulty-nesting } - } + \seq_get:NNF + \g__tag_struct_stack_seq + \l__tag_struct_stack_parent_tmpa_tl + { + \msg_error:nn { tag } { struct-faulty-nesting } + } + } \seq_gpush:NV \g__tag_struct_stack_seq \c@g__tag_struct_abs_int \seq_gpush:NV \g__tag_struct_tag_stack_seq \g__tag_struct_tag_tl \tl_gset:NV \g__tag_struct_stack_current_tl \c@g__tag_struct_abs_int diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def index 74400ea9da6..d28c12ab214 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-backend.dtx -\ProvidesExplFile {tagpdf-luatex.def} {2022-05-29} {0.95} +\ProvidesExplFile {tagpdf-luatex.def} {2022-08-06} {0.96} {tagpdf~driver~for~luatex} { \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty index 1cf381628a1..37034dd31fb 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-08-06} {0.96} {part of tagpdf - code related to marking chunks - generic mode} \__tag_prop_new:N \g__tag_MCID_byabspage_prop @@ -178,7 +178,7 @@ \__tag_check_typeout_v:n {=>~ TME~ not~ missing} } } -\cs_new:Npn\__tag_add_missing_mcs:Nn #1 #2 { +\cs_new_protected:Npn\__tag_add_missing_mcs:Nn #1 #2 { \vbadness \@M \vfuzz \c_max_dim \vbox_set_to_ht:Nnn #1 { \box_ht:N #1 } { @@ -388,7 +388,7 @@ { \tl_put_right:Nx \l__tag_mc_key_properties_tl { #1 } }, - alttext .code:n = % Alt property + alt .code:n = % Alt property { \str_set_convert:Noon \l__tag_tmpa_str @@ -398,6 +398,7 @@ \tl_put_right:Nn \l__tag_mc_key_properties_tl { /Alt~< } \tl_put_right:No \l__tag_mc_key_properties_tl { \l__tag_tmpa_str>~ } }, + alttext .meta:n = {alt=#1}, actualtext .code:n = % ActualText property { \str_set_convert:Noon diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty index ae5f3c12d27..b62d900b62f 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-luacode.dtx -\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-08-06} {0.96} {tagpdf - mc code only for the luamode } \hook_gput_code:nnn{begindocument}{tagpdf/mc} { @@ -232,7 +232,7 @@ ltx.__tag.func.store_mc_data(\__tag_get_mc_abs_cnt:,"raw","#1") } }, - alttext .code:n = % Alt property + alt .code:n = % Alt property { \str_set_convert:Noon \l__tag_tmpa_str @@ -249,6 +249,7 @@ ) } }, + alttext .meta:n = {alt=#1}, actualtext .code:n = % Alt property { \str_set_convert:Noon diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua index c46b157b214..05e314583a0 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua @@ -24,8 +24,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.95", --TAGVERSION - date = "2022-05-29", --TAGDATE + version = "0.96", --TAGVERSION + date = "2022-08-06", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty index c336ce49631..abeb7530146 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty @@ -27,7 +27,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdf} {2022-08-06} {0.96} { A package to experiment with pdf tagging } \bool_if:nF @@ -57,6 +57,44 @@ \ProcessOptions \RequirePackage{l3ref-tmp} \RequirePackage{tagpdf-base} +\cs_if_free:NT \pdf_object_write_dict:nn + { + \cs_set_eq:NN \pdf_object_write_dict:nn \pdf_object_write:nn + } +\cs_generate_variant:Nn \pdf_object_write_dict:nn {nx} + +\str_if_eq:VnT \c_sys_backend_str {pdftex} + { + \cs_if_free:NT \__pdf_backend_object_write_dict:nn + { + \cs_new_protected:Npn \__pdf_backend_object_write_dict:nn #1#2 + { + \tex_immediate:D \tex_pdfobj:D + useobjnum ~ + \int_use:c + { c__pdf_backend_object_ \tl_to_str:n {#1} _int } + { << ~ \exp_not:n {#2} ~ >> } + } + \cs_set_eq:NN \pdf_object_write_dict:nn \__pdf_backend_object_write_dict:nn + } + } + +\str_if_eq:VnT \c_sys_backend_str {luatex} + { + \cs_if_free:NT \__pdf_backend_object_write_dict:nn + { + \cs_new_protected:Npn \__pdf_backend_object_write_dict:nn #1#2 + { + \tex_immediate:D \tex_pdfextension:D obj ~ + useobjnum ~ + \int_use:c + { c__pdf_backend_object_ \tl_to_str:n {#1} _int } + { << ~ \exp_not:n {#2} ~ >> } + } + \cs_set_eq:NN \pdf_object_write_dict:nn \__pdf_backend_object_write_dict:nn + } + } + \cs_new_protected:Npn \__tag_lastpagelabel: { \legacy_if:nT { @filesw } @@ -94,6 +132,7 @@ } \tl_new:N \l__tag_tmpa_tl +\tl_new:N \l__tag_tmpb_tl \str_new:N \l__tag_tmpa_str \prop_new:N \l__tag_tmpa_prop \seq_new:N \l__tag_tmpa_seq @@ -123,9 +162,11 @@ \cs_generate_variant:Nn \pdffile_embed_stream:nnn {nxx,oxx} \cs_generate_variant:Nn \prop_gput:Nnn {Nxx,Nen} \cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\cs_generate_variant:Nn \prop_item:Nn {No} \cs_generate_variant:Nn \ref_label:nn { nv } \cs_generate_variant:Nn \seq_set_split:Nnn{Nne} \cs_generate_variant:Nn \str_set_convert:Nnnn {Nonn, Noon, Nnon } +\cs_generate_variant:Nn \clist_map_inline:nn {on} \ref_attribute_gset:nnnn { tagstruct } {0} { now } { \int_use:N \c@g__tag_struct_abs_int } @@ -174,7 +215,6 @@ \cs_generate_variant:Nn \__tag_seq_new:N { c } \cs_generate_variant:Nn \__tag_seq_show:N { c } \cs_generate_variant:Nn \__tag_prop_show:N { c } - \cs_new_protected:Npn \tag_stop_group_begin: { \group_begin: @@ -182,11 +222,38 @@ \bool_set_false:N \l__tag_active_mc_bool } \cs_set_eq:NN \tag_stop_group_end: \group_end: -\cs_new_protected:Npn \tag_stop: +\cs_set_protected:Npn \tag_stop: { \bool_set_false:N \l__tag_active_struct_bool \bool_set_false:N \l__tag_active_mc_bool } +\cs_set_protected:Npn \tag_start: + { + \bool_set_true:N \l__tag_active_struct_bool + \bool_set_true:N \l__tag_active_mc_bool + } +\prop_new:N\g__tag_state_prop +\cs_set_protected:Npn \tag_stop:n #1 + { + \tag_if_active:TF + { + \bool_set_false:N \l__tag_active_struct_bool + \bool_set_false:N \l__tag_active_mc_bool + \prop_gput:Nnn \g__tag_state_prop { #1 }{ 1 } + } + { + \prop_gremove:Nn \g__tag_state_prop { #1 } + } + } +\cs_set_protected:Npn \tag_start:n #1 + { + \prop_gpop:NnN \g__tag_state_prop {#1}\l__tag_tmpa_tl + \quark_if_no_value:NF \l__tag_tmpa_tl + { + \bool_set_true:N \l__tag_active_struct_bool + \bool_set_true:N \l__tag_active_mc_bool + } + } \keys_define:nn { __tag / setup } { @@ -243,6 +310,8 @@ {abscnt=\__tag_get_mc_abs_cnt:,~tag=\g__tag_mc_key_tag_tl} {no~MC~open,~current~abscnt=\__tag_get_mc_abs_cnt:"} } +\msg_new:nnn { tag } {struct-unknown} + { structure~with~number~#1~doesn't~exist\\ #2 } \msg_new:nnn { tag } {struct-no-objnum} { objnum~missing~for~structure~#1 } \msg_new:nnn { tag } {struct-faulty-nesting} @@ -630,6 +699,8 @@ }, } %% File: tagpdf.dtx + + \bool_if:NTF \g__tag_mode_lua_bool { \RequirePackage {tagpdf-mc-code-lua} @@ -772,7 +843,7 @@ \__tag_tree_fill_parenttree: } \tl_put_right:NV \l__tag_parenttree_content_tl\g__tag_parenttree_objr_tl - \pdf_object_write:nx { __tag/tree/parenttree } + \pdf_object_write_dict:nx { __tag/tree/parenttree } { /Nums\c_space_tl [\l__tag_parenttree_content_tl] } @@ -780,7 +851,7 @@ \pdf_object_new:nn { __tag/tree/rolemap }{ dict } \cs_new_protected:Npn \__tag_tree_write_rolemap: { - \pdf_object_write:nx { __tag/tree/rolemap } + \pdf_object_write_dict:nx { __tag/tree/rolemap } { \pdfdict_use:n{g__tag_role/RoleMap_dict} } @@ -808,7 +879,7 @@ \l__tag_tmpa_tl { \pdf_object_new:nn { __tag/tree/classmap }{ dict } - \pdf_object_write:nx + \pdf_object_write_dict:nx { __tag/tree/classmap } { \l__tag_tmpa_tl } \__tag_prop_gput:cnx @@ -824,19 +895,19 @@ { \pdfdict_if_empty:nF {g__tag_role/RoleMapNS_##1_dict} { - \pdf_object_write:nx {__tag/RoleMapNS/##1} + \pdf_object_write_dict:nx {__tag/RoleMapNS/##1} { \pdfdict_use:n {g__tag_role/RoleMapNS_##1_dict} } \pdfdict_gput:nnx{g__tag_role/Namespace_##1_dict} {RoleMapNS}{\pdf_object_ref:n {__tag/RoleMapNS/##1}} } - \pdf_object_write:nx{tag/NS/##1} + \pdf_object_write_dict:nx{tag/NS/##1} { \pdfdict_use:n {g__tag_role/Namespace_##1_dict} } } - \pdf_object_write:nx {__tag/tree/namespaces} + \pdf_object_write:nx {__tag/tree/namespaces} %array { \prop_map_tokens:Nn \g__tag_role_NS_prop{\use_ii:nn} } @@ -1372,7 +1443,6 @@ \seq_gpush:Nn \g__tag_struct_stack_seq {0} \seq_new:N \g__tag_struct_tag_stack_seq \seq_gpush:Nn \g__tag_struct_tag_stack_seq {Root} -\tl_new:N \g__tag_struct_stack_current_tl \tl_new:N \l__tag_struct_stack_parent_tmpa_tl \seq_const_from_clist:Nn \c__tag_struct_StructTreeRoot_entries_seq @@ -1588,11 +1658,20 @@ { g__tag_struct_#1_prop } { ##1 } { - \c_space_tl/##1~\prop_item:cn{ g__tag_struct_#1_prop } { ##1 } + \c_space_tl/##1~ + \cs_if_exist_use:cTF {__tag_struct_format_##1:e} + { + { \prop_item:cn{ g__tag_struct_#1_prop } { ##1 } } + } + { + \prop_item:cn{ g__tag_struct_#1_prop } { ##1 } + } } } } } +\cs_new:Nn\__tag_struct_format_Ref:n{[#1]} +\cs_generate_variant:Nn\__tag_struct_format_Ref:n{e} \cs_new_protected:Npn \__tag_struct_write_obj:n #1 % #1 is the struct num { \pdf_object_if_exist:nTF { __tag/struct/#1 } @@ -1600,7 +1679,7 @@ \__tag_struct_fill_kid_key:n { #1 } \__tag_struct_get_dict_content:nN { #1 } \l__tag_tmpa_tl \exp_args:Nx - \pdf_object_write:nx + \pdf_object_write_dict:nx { __tag/struct/#1 } { \l__tag_tmpa_tl @@ -1660,9 +1739,26 @@ { label .tl_set:N = \l__tag_struct_key_label_tl, stash .bool_set:N = \l__tag_struct_elem_stash_bool, + parent .code:n = + { + \bool_lazy_and:nnTF + { + \prop_if_exist_p:c { g__tag_struct_\int_eval:n {#1}_prop } + } + { + \int_compare_p:nNn {#1}<{\c@g__tag_struct_abs_int} + } + { \tl_set:Nx \l__tag_struct_stack_parent_tmpa_tl { \int_eval:n {#1} } } + { + \msg_warning:nnxx { tag } { struct-unknown } + { \int_eval:n {#1} } + { parent~key~ignored } + } + }, + parent .default:n = {-1}, tag .code:n = % S property { - \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:Nn\g__tag_role_tags_NS_prop{#1}} + \seq_set_split:Nne \l__tag_tmpa_seq { / } {#1/\prop_item:No\g__tag_role_tags_NS_prop{#1}} \tl_gset:Nx \g__tag_struct_tag_tl { \seq_item:Nn\l__tag_tmpa_seq {1} } \tl_gset:Nx \g__tag_struct_tag_NS_tl { \seq_item:Nn\l__tag_tmpa_seq {2} } \__tag_check_structure_tag:N \g__tag_struct_tag_tl @@ -1702,7 +1798,7 @@ { T } { <\l__tag_tmpa_str> } }, - alttext .code:n = % Alt property + alt .code:n = % Alt property { \str_set_convert:Noon \l__tag_tmpa_str @@ -1714,6 +1810,7 @@ { Alt } { <\l__tag_tmpa_str> } }, + alttext .meta:n = {alt=#1}, actualtext .code:n = % ActualText property { \str_set_convert:Noon @@ -1733,18 +1830,15 @@ { Lang } { (#1) } }, - ref .code:n = % Lang property + ref .code:n = % ref property { \tl_clear:N\l__tag_tmpa_tl - \clist_map_inline:nn {#1} + \clist_map_inline:on {#1} { \tl_put_right:Nx \l__tag_tmpa_tl {~\ref_value:nn{tagpdfstruct-##1}{tagstructobj} } } - \__tag_prop_gput:cnx - { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop } - { Ref } - { [\l__tag_tmpa_tl] } + \__tag_struct_gput_data_ref:ee { \int_eval:n {\c@g__tag_struct_abs_int} } {\l__tag_tmpa_tl} }, E .code:n = % E property { @@ -1888,6 +1982,7 @@ { g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop } { Type } { /StructElem } + \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1} \keys_set:nn { __tag / struct} { #1 } \__tag_check_structure_has_tag:n { \int_eval:n {\c@g__tag_struct_abs_int} } \tl_if_empty:NF @@ -1895,13 +1990,15 @@ { \__tag_ref_label:en{tagpdfstruct-\l__tag_struct_key_label_tl}{struct} } - %get the potential parent from the stack: - \seq_get:NNF - \g__tag_struct_stack_seq - \l__tag_struct_stack_parent_tmpa_tl + \int_compare:nNnT { \l__tag_struct_stack_parent_tmpa_tl } = { -1 } { - \msg_error:nn { tag } { struct-faulty-nesting } - } + \seq_get:NNF + \g__tag_struct_stack_seq + \l__tag_struct_stack_parent_tmpa_tl + { + \msg_error:nn { tag } { struct-faulty-nesting } + } + } \seq_gpush:NV \g__tag_struct_stack_seq \c@g__tag_struct_abs_int \seq_gpush:NV \g__tag_struct_tag_stack_seq \g__tag_struct_tag_tl \tl_gset:NV \g__tag_struct_stack_current_tl \c@g__tag_struct_abs_int @@ -1980,6 +2077,34 @@ } } } +\cs_new:Npn \tag_struct_object_ref:n #1 + { + \pdf_object_ref:n {__tag/struct/#1} + } +\cs_generate_variant:Nn \tag_struct_object_ref:n {e} +\cs_new_protected:Npn \tag_struct_gput:nnn #1 #2 #3 + { + \cs_if_exist_use:cF {__tag_struct_gput_data_#2:nn} + { %warning?? + \use_none:nn + } + {#1}{#3} + } +\cs_generate_variant:Nn \tag_struct_gput:nnn {ene,nne} +\cs_new_protected:Npn \__tag_struct_gput_data_ref:nn #1 #2 + % #1 receiving struct num, #2 list of object ref + { + \prop_get:cnN + { g__tag_struct_#1_prop } + {Ref} + \l__tag_tmpb_tl + \__tag_prop_gput:cnx + { g__tag_struct_#1_prop } + { Ref } + { \quark_if_no_value:NF\l__tag_tmpb_tl { \l__tag_tmpb_tl\c_space_tl }#2 } + } +\cs_generate_variant:Nn \__tag_struct_gput_data_ref:nn {ee} + \cs_new_protected:Npn \tag_struct_insert_annot:nn #1 #2 %#1 should be an object reference %#2 struct parent num { @@ -2163,46 +2288,16 @@ %% File: tagpdf-user.dtx -\NewDocumentCommand \tagpdfsetup { m } +\RenewDocumentCommand \tagpdfsetup { m } { \keys_set:nn { __tag / setup } { #1 } } -\NewDocumentCommand \tagmcbegin { m } - { - \tag_mc_begin:n {#1}%\ignorespaces - } - -\NewDocumentCommand \tagmcend { } - { - %\if_mode_horizontal: \unskip \fi: % - \tag_mc_end: - } - -\NewDocumentCommand \tagmcuse { m } - { - \tag_mc_use:n {#1} - } - \NewDocumentCommand \tagmcifinTF { m m } { \tag_mc_if_in:TF { #1 } { #2 } } -\NewDocumentCommand \tagstructbegin { m } - { - \tag_struct_begin:n {#1} - } - -\NewDocumentCommand \tagstructend { } - { - \tag_struct_end: - } - -\NewDocumentCommand \tagstructuse { m } - { - \tag_struct_use:n {#1} - } \NewDocumentCommand\ShowTagging { m } { \keys_set:nn { __tag / show }{ #1} @@ -2373,10 +2468,13 @@ \bool_new:N \l__tag_para_show_bool \int_new:N \g__tag_para_begin_int \int_new:N \g__tag_para_end_int +\tl_new:N \l__tag_para_tag_tl +\tl_set:Nn \l__tag_para_tag_tl { P } \keys_define:nn { __tag / setup } { paratagging .bool_set:N = \l__tag_para_bool, paratagging-show .bool_set:N = \l__tag_para_show_bool, + paratag .tl_set:N = \l__tag_para_tag_tl } \AddToHook{para/begin} @@ -2384,13 +2482,13 @@ \bool_if:NT \l__tag_para_bool { \int_gincr:N \g__tag_para_begin_int - \tag_struct_begin:n {tag=P} + \tag_struct_begin:n {tag=\l__tag_para_tag_tl} \bool_if:NT \l__tag_para_show_bool { \tag_mc_begin:n{artifact} \llap{\color_select:n{red}\tiny\int_use:N\g__tag_para_begin_int\ } \tag_mc_end: } - \tag_mc_begin:n {tag=P} + \tag_mc_begin:n {tag=\l__tag_para_tag_tl} } } \AddToHook{para/end} @@ -2443,8 +2541,8 @@ } } } -\newcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool} -\newcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool} +\renewcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool} +\renewcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool} \NewDocumentCommand\tagpdfsuppressmarks{m} {{\use:c{__tag_mc_disable_marks:} #1}} \cs_new_protected:Npn\__tag_hook_kernel_before_head:{} diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty index 677e2b50704..60aee8f3642 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty @@ -1,5 +1,5 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2022-05-29} {0.95} +\ProvidesExplPackage {tagpdfdocu-patches} {2022-08-06} {0.96} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox} |