summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tagpdf
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-13 21:05:40 +0000
committerKarl Berry <karl@freefriends.org>2022-01-13 21:05:40 +0000
commitd8a708abc1ed023e582f732ac87e906bba4d884c (patch)
tree3212c9992cf00ad728c8dceb83f414377b6fcebf /Master/texmf-dist/tex/latex/tagpdf
parent031d7dac6f41c0c635cb8e8fa08cf794a1cc80c1 (diff)
tagpdf (13jan22)
git-svn-id: svn://tug.org/texlive/trunk@61600 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tagpdf')
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty79
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty24
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty235
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def4
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty4
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty5
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua6
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty955
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty50
9 files changed, 880 insertions, 482 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
new file mode 100644
index 00000000000..451799c0733
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
@@ -0,0 +1,79 @@
+%%
+%% This is file `tagpdf-debug-generic.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-mc-generic.dtx (with options: `debug')
+%%
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%%
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version. The latest
+%% version of this license is in the file:
+%%
+%% https://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% File: tagpdf-mc.dtx
+\ProvidesExplPackage {tagpdf-debug-generic} {2022-01-13} {0.93}
+ {part of tagpdf - debugging code related to marking chunks - generic mode}
+\cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
+ {
+ \__tag_check_if_active_mc:TF
+ {
+ \__tag_debug_mc_begin_insert:n { #1 }
+ \group_begin: %hm
+ \__tag_check_mc_if_nested:
+ \bool_gset_true:N \g__tag_in_mc_bool
+ \keys_set:nn { __tag / mc } {#1}
+ \bool_if:NTF \l__tag_mc_artifact_bool
+ { %handle artifact
+ \__tag_mc_handle_artifact:N \l__tag_mc_artifact_type_tl
+ \exp_args:NV
+ \__tag_mc_artifact_begin_marks:n \l__tag_mc_artifact_type_tl
+ }
+ { %handle mcid type
+ \__tag_check_mc_tag:N \l__tag_mc_key_tag_tl
+ \__tag_mc_handle_mcid:VV
+ \l__tag_mc_key_tag_tl
+ \l__tag_mc_key_properties_tl
+ \__tag_mc_begin_marks:oo{\l__tag_mc_key_tag_tl}{\l__tag_mc_key_label_tl}
+ \tl_if_empty:NF {\l__tag_mc_key_label_tl}
+ {
+ \exp_args:NV
+ \__tag_mc_handle_mc_label:n \l__tag_mc_key_label_tl
+ }
+ \bool_if:NF \l__tag_mc_key_stash_bool
+ {
+ \__tag_mc_handle_stash:x { \int_use:N \c@g__tag_MCID_abs_int }
+ }
+ }
+ \group_end:
+ }
+ {
+ \__tag_debug_mc_begin_ignore:n { #1 }
+ }
+ }
+\cs_set_protected:Nn \tag_mc_end:
+ {
+ \__tag_check_if_active_mc:TF
+ {
+ \__tag_debug_mc_end_insert:
+ \__tag_check_mc_if_open:
+ \bool_gset_false:N \g__tag_in_mc_bool
+ \tl_gset:Nn \g__tag_mc_key_tag_tl { }
+ \__tag_mc_emc:
+ \__tag_mc_end_marks:
+ }
+ {
+ \__tag_debug_mc_end_ignore:
+ }
+ }
+
+%%
+%%
+%% End of file `tagpdf-debug-generic.sty'.
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
new file mode 100644
index 00000000000..f559bd2a34f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
@@ -0,0 +1,24 @@
+%%
+%% This is file `tagpdf-debug-lua.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf-mc-luacode.dtx (with options: `debug')
+%%
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%%
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version. The latest
+%% version of this license is in the file:
+%%
+%% https://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% File: tagpdf-mc.dtx
+%%
+%%
+%% End of file `tagpdf-debug-lua.sty'.
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
new file mode 100644
index 00000000000..e15bd0955a5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
@@ -0,0 +1,235 @@
+%%
+%% This is file `tagpdf-debug.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tagpdf.dtx (with options: `debug')
+%% tagpdf-checks.dtx (with options: `debug')
+%% tagpdf-user.dtx (with options: `debug')
+%% tagpdf-mc-shared.dtx (with options: `debug')
+%% tagpdf-tree.dtx (with options: `debug')
+%% tagpdf-roles.dtx (with options: `debug')
+%% tagpdf-struct.dtx (with options: `debug')
+%% tagpdf-space.dtx (with options: `debug')
+%%
+%% Copyright (C) 2019-2022 Ulrike Fischer
+%%
+%% It may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License (LPPL), either version 1.3c of
+%% this license or (at your option) any later version. The latest
+%% version of this license is in the file:
+%%
+%% https://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "tagpdf bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% File: tagpdf.dtx
+\ProvidesExplPackage {tagpdf-debug} {2022-01-13} {0.93}
+ { 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}
+ }
+ {
+ \RequirePackage {tagpdf-debug-generic} %
+ }
+%% File: tagpdf-checks.dtx
+\msg_new:nnn { tag / debug } {mc-begin} { MC~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:] }
+\msg_new:nnn { tag / debug } {mc-end} { MC~end~#1~[\msg_line_context:] }
+
+\cs_new_protected:Npn \__tag_debug_mc_begin_insert:n #1
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnnn { tag / debug } {mc-begin} {inserted} { #1 }
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_mc_begin_ignore:n #1
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnnn { tag / debug } {mc-begin } {ignored} { #1 }
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_mc_end_insert:
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnn { tag / debug } {mc-end} {inserted}
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_mc_end_ignore:
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnn { tag / debug } {mc-end } {ignored}
+ }
+ }
+\msg_new:nnn { tag / debug } {struct-begin}
+ {
+ Struct~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:]
+ }
+\msg_new:nnn { tag / debug } {struct-end}
+ {
+ Struct~end~#1~[\msg_line_context:]
+ }
+
+\cs_new_protected:Npn \__tag_debug_struct_begin_insert:n #1
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnnn { tag / debug } {struct-begin} {inserted} { #1 }
+ \seq_log:N \g__tag_struct_tag_stack_seq
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_struct_begin_ignore:n #1
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnnn { tag / debug } {struct-begin } {ignored} { #1 }
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_struct_end_insert:
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnn { tag / debug } {struct-end} {inserted}
+ \seq_log:N \g__tag_struct_tag_stack_seq
+ }
+ }
+\cs_new_protected:Npn \__tag_debug_struct_end_ignore:
+ {
+ \int_compare:nNnT { \l__tag_loglevel_int } > {0}
+ {
+ \msg_note:nnn { tag / debug } {struct-end } {ignored}
+ }
+ }
+%% File: tagpdf-user.dtx
+
+
+%% File: tagpdf-mc.dtx
+
+%% File: tagpdf-tree.dtx
+%% File: tagpdf-roles.dtx
+%% File: tagpdf-struct.dtx
+\keys_define:nn { __tag / setup }
+ {
+ root-AF .code:n =
+ {
+ \pdf_object_if_exist:nTF {#1}
+ {
+ \__tag_struct_add_AF:en { 0 }{#1}
+ \__tag_prop_gput:cnx
+ { g__tag_struct_0_prop }
+ { AF }
+ {
+ [
+ \tl_use:c
+ { g__tag_struct_0_AF_tl }
+ ]
+ }
+ }
+ {
+
+ }
+ },
+ }
+\cs_set_protected:Npn \tag_struct_begin:n #1 %#1 key-val
+ {
+\__tag_check_if_active_struct:TF
+ {
+ \group_begin:
+ \int_gincr:N \c@g__tag_struct_abs_int
+ \__tag_prop_new:c { g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop }
+ \__tag_new_output_prop_handler:n {\int_eval:n { \c@g__tag_struct_abs_int }}
+ \__tag_seq_new:c { g__tag_struct_kids_\int_eval:n { \c@g__tag_struct_abs_int }_seq}
+ \exp_args:Ne
+ \pdf_object_new:nn
+ { __tag/struct/\int_eval:n { \c@g__tag_struct_abs_int } }
+ { dict }
+ \__tag_prop_gput:cno
+ { g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop }
+ { Type }
+ { /StructElem }
+ \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
+ \l__tag_struct_key_label_tl
+ {
+ \__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
+ {
+ \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
+ %\seq_show:N \g__tag_struct_stack_seq
+ \bool_if:NF
+ \l__tag_struct_elem_stash_bool
+ {%set the parent
+ \__tag_prop_gput:cnx
+ { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop }
+ { P }
+ {
+ \pdf_object_ref:e { __tag/struct/\l__tag_struct_stack_parent_tmpa_tl }
+ }
+ %record this structure as kid:
+ %\tl_show:N \g__tag_struct_stack_current_tl
+ %\tl_show:N \l__tag_struct_stack_parent_tmpa_tl
+ \__tag_struct_kid_struct_gput_right:xx
+ { \l__tag_struct_stack_parent_tmpa_tl }
+ { \g__tag_struct_stack_current_tl }
+ %\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }
+ %\seq_show:c {g__tag_struct_kids_\l__tag_struct_stack_parent_tmpa_tl _seq}
+ }
+ %\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }
+ %\seq_show:c {g__tag_struct_kids_\l__tag_struct_stack_parent_tmpa_tl _seq}
+ \__tag_debug_struct_begin_insert:n { #1 }
+ \group_end:
+ }
+{ \__tag_debug_struct_begin_ignore:n { #1 }}
+ }
+\cs_set_protected:Nn \tag_struct_end:
+ { %take the current structure num from the stack:
+ %the objects are written later, lua mode hasn't all needed info yet
+ %\seq_show:N \g__tag_struct_stack_seq
+\__tag_check_if_active_struct:TF
+ {
+ \seq_gpop:NN \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl
+ \seq_gpop:NNTF \g__tag_struct_stack_seq \l__tag_tmpa_tl
+ {
+ \__tag_check_info_closing_struct:o { \g__tag_struct_stack_current_tl }
+ }
+ { \__tag_check_no_open_struct: }
+ % get the previous one, shouldn't be empty as the root should be there
+ \seq_get:NNTF \g__tag_struct_stack_seq \l__tag_tmpa_tl
+ {
+ \tl_gset:NV \g__tag_struct_stack_current_tl \l__tag_tmpa_tl
+ }
+ {
+ \__tag_check_no_open_struct:
+ }
+ \seq_get:NNT \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl
+ {
+ \tl_gset:NV \g__tag_struct_tag_tl \l__tag_tmpa_tl
+ }
+\__tag_debug_struct_end_insert:
+ }
+{\__tag_debug_struct_end_ignore:}
+ }
+
+%% File: tagpdf-space.dtx
+%%
+%%
+%% End of file `tagpdf-debug.sty'.
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
index 16d7b48e6cd..098b48eaa0a 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
@@ -6,7 +6,7 @@
%%
%% tagpdf-backend.dtx (with options: `luatex')
%%
-%% Copyright (C) 2019-2021 Ulrike Fischer
+%% Copyright (C) 2019-2022 Ulrike Fischer
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-luatex.def} {2021-08-27} {0.92}
+\ProvidesExplFile {tagpdf-luatex.def} {2022-01-13} {0.93}
{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 ac7f56afc80..e1e7ea01889 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
@@ -6,7 +6,7 @@
%%
%% tagpdf-mc-generic.dtx (with options: `generic')
%%
-%% Copyright (C) 2019-2021 Ulrike Fischer
+%% Copyright (C) 2019-2022 Ulrike Fischer
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-mc.dtx
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2021-08-27} {0.92}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2022-01-13} {0.93}
{part of tagpdf - code related to marking chunks - generic mode}
\__tag_prop_new:N \g__tag_MCID_byabspage_prop
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 e307ec22bba..3df23dd015b 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
@@ -6,7 +6,7 @@
%%
%% tagpdf-mc-luacode.dtx (with options: `luamode')
%%
-%% Copyright (C) 2019-2021 Ulrike Fischer
+%% Copyright (C) 2019-2022 Ulrike Fischer
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -19,8 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-mc.dtx
-
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2021-08-27} {0.92}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2022-01-13} {0.93}
{tagpdf - mc code only for the luamode }
\hook_gput_code:nnn{begindocument}{tagpdf/mc}
{
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
index 05d9c04eb78..4805c3b882f 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
@@ -6,7 +6,7 @@
--
-- tagpdf-backend.dtx (with options: `lua')
--
--- Copyright (C) 2019-2021 Ulrike Fischer
+-- Copyright (C) 2019-2022 Ulrike Fischer
--
-- It may be distributed and/or modified under the conditions of
-- the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -24,8 +24,8 @@
local ProvidesLuaModule = {
name = "tagpdf",
- version = "0.92", --TAGVERSION
- date = "2021-08-27", --TAGDATE
+ version = "0.93", --TAGVERSION
+ date = "2022-01-13", --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 83a173ba6de..822b654d92a 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
@@ -6,15 +6,15 @@
%%
%% tagpdf.dtx (with options: `package')
%% tagpdf-checks.dtx (with options: `package')
-%% tagpdf-user.dtx (with options: `package')
%% tagpdf-mc-shared.dtx (with options: `shared')
%% tagpdf.dtx (with options: `mcloading')
%% tagpdf-tree.dtx (with options: `package')
%% tagpdf-roles.dtx (with options: `package')
%% tagpdf-struct.dtx (with options: `package')
%% tagpdf-space.dtx (with options: `package')
+%% tagpdf-user.dtx (with options: `package')
%%
-%% Copyright (C) 2019-2021 Ulrike Fischer
+%% Copyright (C) 2019-2022 Ulrike Fischer
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -27,7 +27,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2021-08-27} {0.92}
+\ProvidesExplPackage {tagpdf} {2022-01-13} {0.93}
{ A package to experiment with pdf tagging }
\bool_if:nF
@@ -49,10 +49,7 @@
before~\string\documentclass
}
}
-\prop_if_exist:NT \g_msg_module_name_prop
- {
- \prop_gput:Nnn \g_msg_module_name_prop { tag }{ tagpdf }
- }
+\prop_gput:Nnn \g_msg_module_name_prop { tag }{ tagpdf }
\bool_new:N\g__tag_mode_lua_bool
\DeclareOption {luamode} { \sys_if_engine_luatex:T { \bool_gset_true:N \g__tag_mode_lua_bool } }
\DeclareOption {genericmode}{ \bool_gset_false:N\g__tag_mode_lua_bool }
@@ -111,6 +108,8 @@
\bool_new:N \g__tag_active_mc_bool
\bool_new:N \g__tag_active_tree_bool
\bool_new:N \g__tag_active_struct_bool
+\bool_new:N \g__tag_active_struct_dest_bool
+\bool_gset_true:N \g__tag_active_struct_dest_bool
\bool_new:N \l__tag_active_mc_bool
\bool_set_true:N \l__tag_active_mc_bool
@@ -190,7 +189,9 @@
activate-tree .bool_gset:N = \g__tag_active_tree_bool,
activate-struct .bool_gset:N = \g__tag_active_struct_bool,
activate-all .meta:n =
- {activate-mc,activate-tree,activate-struct},
+ {activate-mc={#1},activate-tree={#1},activate-struct={#1}},
+ activate-all .default:n = true,
+ no-struct-dest .bool_gset_inverse:N = \g__tag_active_struct_dest_bool,
% \end{macrocode}
log .choice:,
log / none .code:n = {\int_set:Nn \l__tag_loglevel_int { 0 }},
@@ -221,7 +222,6 @@
\file_input:n {tagpdf-luatex.def}
}
%% File: tagpdf-checks.dtx
-
\msg_new:nnn { tag } {mc-nested} { nested~marked~content~found~-~mcid~#1 }
\msg_new:nnn { tag } {mc-tag-missing} { required~tag~missing~-~mcid~#1 }
\msg_new:nnn { tag } {mc-label-unknown}
@@ -490,401 +490,6 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
-%% File: tagpdf-user.dtx
-
-
-\NewDocumentCommand \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}
- }
-\cs_set_eq:NN\tagpdfifluatexTF \sys_if_engine_luatex:TF
-\cs_set_eq:NN\tagpdfifluatexT \sys_if_engine_luatex:T
-\cs_set_eq:NN\tagpdfifpdftexT \sys_if_engine_pdftex:T
-\NewDocumentCommand\ShowTagging { m }
- {
- \keys_set:nn { __tag / show }{ #1}
-
- }
-\keys_define:nn { __tag / show }
- {
- mc-data .code:n =
- {
- \sys_if_engine_luatex:T
- {
- \lua_now:e{ltx.__tag.trace.show_all_mc_data(#1,\__tag_get_mc_abs_cnt:,0)}
- }
- }
- ,mc-data .default:n = 1
- }
-
-\keys_define:nn { __tag / show }
- { mc-current .code:n =
- {
- \bool_if:NTF \g__tag_mode_lua_bool
- {
- \sys_if_engine_luatex:T
- {
- \int_compare:nNnTF
- { -2147483647 }
- =
- {
- \lua_now:e
- {
- tex.print
- (tex.getattribute
- (luatexbase.attributes.g__tag_mc_cnt_attr))
- }
- }
- {
- \lua_now:e
- {
- ltx.__tag.trace.log
- (
- "mc-current:~no~MC~open,~current~abscnt
- =\__tag_get_mc_abs_cnt:"
- ,0
- )
- texio.write_nl("")
- }
- }
- {
- \lua_now:e
- {
- ltx.__tag.trace.log
- (
- "mc-current:~abscnt=\__tag_get_mc_abs_cnt:=="
- ..
- tex.getattribute(luatexbase.attributes.g__tag_mc_cnt_attr)
- ..
- "~=>tag="
- ..
- tostring
- (ltx.__tag.func.get_tag_from
- (tex.getattribute
- (luatexbase.attributes.g__tag_mc_type_attr)))
- ..
- "="
- ..
- tex.getattribute
- (luatexbase.attributes.g__tag_mc_type_attr)
- ,0
- )
- texio.write_nl("")
- }
- }
- }
- }
- {
- \msg_note:nn{ tag }{ mc-current }
- }
- }
- }
-\keys_define:nn { __tag / show }
- {
- mc-marks .choice: ,
- mc-marks / show .code:n =
- {
- \__tag_mc_get_marks:
- \__tag_check_if_mc_in_galley:TF
- {
- \iow_term:n {Marks~from~this~page:~}
- }
- {
- \iow_term:n {Marks~from~a~previous~page:~}
- }
- \seq_show:N \l__tag_mc_firstmarks_seq
- \seq_show:N \l__tag_mc_botmarks_seq
- \__tag_check_if_mc_tmb_missing:T
- {
- \iow_term:n {BDC~missing~on~this~page!}
- }
- \__tag_check_if_mc_tme_missing:T
- {
- \iow_term:n {EMC~missing~on~this~page!}
- }
- },
- mc-marks / use .code:n =
- {
- \__tag_mc_get_marks:
- \__tag_check_if_mc_in_galley:TF
- { Marks~from~this~page:~}
- { Marks~from~a~previous~page:~}
- \seq_use:Nn \l__tag_mc_firstmarks_seq {,~}\quad
- \seq_use:Nn \l__tag_mc_botmarks_seq {,~}\quad
- \__tag_check_if_mc_tmb_missing:T
- {
- BDC~missing~
- }
- \__tag_check_if_mc_tme_missing:T
- {
- EMC~missing
- }
- },
- mc-marks .default:n = show
- }
-\keys_define:nn { __tag / show }
- {
- struct-stack .choice:
- ,struct-stack / log .code:n = \seq_log:N \g__tag_struct_tag_stack_seq
- ,struct-stack / show .code:n = \seq_show:N \g__tag_struct_tag_stack_seq
- ,struct-stack .default:n = show
- }
-\cs_new_protected:Npn \__tag_add_document_structure:n #1
- {
- \hook_gput_code:nnn{begindocument}{tagpdf}{\tagstructbegin{tag=#1}}
- \hook_gput_code:nnn{tagpdf/finish/before}{tagpdf}{\tagstructend}
- }
-\keys_define:nn { __tag / setup}
- {
- activate .code:n =
- {
- \keys_set:nn { __tag / setup }
- { activate-mc,activate-tree,activate-struct }
- \__tag_add_document_structure:n {#1}
- },
- activate .default:n = Document
- }
-\sys_if_engine_luatex:T
- {
- \NewDocumentCommand\pdffakespace { }
- {
- \__tag_fakespace:
- }
- }
-\bool_new:N \l__tag_para_bool
-\bool_new:N \l__tag_para_show_bool
-\int_new:N \g__tag_para_begin_int
-\int_new:N \g__tag_para_end_int
-\keys_define:nn { __tag / setup }
- {
- paratagging .bool_set:N = \l__tag_para_bool,
- paratagging-show .bool_set:N = \l__tag_para_show_bool,
- }
-
-\AddToHook{para/begin}
- {
- \bool_if:NT \l__tag_para_bool
- {
- \int_gincr:N \g__tag_para_begin_int
- \tag_struct_begin:n {tag=P}
- \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}
- }
- }
-\AddToHook{para/end}
- {
- \bool_if:NT \l__tag_para_bool
- {
- \int_gincr:N \g__tag_para_end_int
- \tag_mc_end:
- \bool_if:NT \l__tag_para_show_bool
- { \tag_mc_begin:n{artifact}
- \rlap{\color_select:n{red}\tiny\ \int_use:N\g__tag_para_end_int}
- \tag_mc_end:
- }
- \tag_struct_end:
- }
- }
-\AddToHook{enddocument/info}
- {
- \int_compare:nNnF {\g__tag_para_begin_int}={\g__tag_para_end_int}
- {
- \msg_error:nnxx
- {tag}
- {para-hook-count-wrong}
- {\int_use:N\g__tag_para_begin_int}
- {\int_use:N\g__tag_para_end_int}
- }
- }
-\AddToHook{begindocument/before}
- {
- \bool_if:NF \g__tag_mode_lua_bool
- {
- \cs_if_exist:NT \@kernel@before@footins
- {
- \tl_put_right:Nn \@kernel@before@footins
- { \__tag_add_missing_mcs_to_stream:Nn \footins {footnote} }
- \tl_put_right:Nn \@kernel@before@cclv
- {
- \__tag_check_typeout_v:n {====>~In~\token_to_str:N \@makecol\c_space_tl\the\c@page}
- \__tag_add_missing_mcs_to_stream:Nn \@cclv {main}
- }
- \tl_put_right:Nn \@mult@ptagging@hook
- {
- \__tag_check_typeout_v:n {====>~In~\string\page@sofar}
- \process@cols\mult@gfirstbox
- {
- \__tag_add_missing_mcs_to_stream:Nn \count@ {multicol}
- }
- \__tag_add_missing_mcs_to_stream:Nn \mult@rightbox {multicol}
- }
- }
- }
- }
-\newcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool}
-\newcommand\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:{}
-\cs_new_protected:Npn\__tag_hook_kernel_after_head:{}
-\cs_new_protected:Npn\__tag_hook_kernel_before_foot:{}
-\cs_new_protected:Npn\__tag_hook_kernel_after_foot:{}
-
-\AddToHook{begindocument}
- {
- \cs_if_exist:NT \@kernel@before@head
- {
- \tl_put_right:Nn \@kernel@before@head {\__tag_hook_kernel_before_head:}
- \tl_put_left:Nn \@kernel@after@head {\__tag_hook_kernel_after_head:}
- \tl_put_right:Nn \@kernel@before@foot {\__tag_hook_kernel_before_foot:}
- \tl_put_left:Nn \@kernel@after@foot {\__tag_hook_kernel_after_foot:}
- }
- }
-
-\bool_new:N \g__tag_saved_in_mc_bool
-\cs_new_protected:Npn \__tag_exclude_headfoot_begin:
- {
- \bool_set_false:N \l__tag_para_bool
- \bool_if:NTF \g__tag_mode_lua_bool
- {
- \tag_mc_end_push:
- }
- {
- \bool_gset_eq:NN \g__tag_saved_in_mc_bool \g__tag_in_mc_bool
- \bool_gset_false:N \g__tag_in_mc_bool
- }
- \tag_mc_begin:n {artifact}
- }
-\cs_new_protected:Npn \__tag_exclude_headfoot_end:
- {
- \tag_mc_end:
- \bool_if:NTF \g__tag_mode_lua_bool
- {
- \tag_mc_begin_pop:n{}
- }
- {
- \bool_gset_eq:NN \g__tag_in_mc_bool\g__tag_saved_in_mc_bool
- }
- }
-
-\keys_define:nn { __tag / setup }
- {
- exclude-header-footer .choice:,
- exclude-header-footer / true .code:n =
- {
- \cs_set_eq:NN \__tag_hook_kernel_before_head: \__tag_exclude_headfoot_begin:
- \cs_set_eq:NN \__tag_hook_kernel_before_foot: \__tag_exclude_headfoot_begin:
- \cs_set_eq:NN \__tag_hook_kernel_after_head: \__tag_exclude_headfoot_end:
- \cs_set_eq:NN \__tag_hook_kernel_after_foot: \__tag_exclude_headfoot_end:
- },
- exclude-header-footer / false .code:n =
- {
- \cs_set_eq:NN \__tag_hook_kernel_before_head: \prg_do_nothing:
- \cs_set_eq:NN \__tag_hook_kernel_before_foot: \prg_do_nothing:
- \cs_set_eq:NN \__tag_hook_kernel_after_head: \prg_do_nothing:
- \cs_set_eq:NN \__tag_hook_kernel_after_foot: \prg_do_nothing:
- },
- exclude-header-footer .default:n = true,
- exclude-header-footer .initial:n = true
- }
-
-\hook_gput_code:nnn
- {pdfannot/link/URI/before}
- {tagpdf}
- {
- \tag_mc_end_push:
- \tag_struct_begin:n { tag=Link }
- \tag_mc_begin:n { tag=Link }
- \pdfannot_dict_put:nnx
- { link/URI }
- { StructParent }
- { \tag_struct_parent_int: }
- }
-
-\hook_gput_code:nnn
- {pdfannot/link/URI/after}
- {tagpdf}
- {
- \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:}
- \tag_mc_end:
- \tag_struct_end:
- \tag_mc_begin_pop:n{}
- }
-
-\hook_gput_code:nnn
- {pdfannot/link/GoTo/before}
- {tagpdf}
- {
- \tag_mc_end_push:
- \tag_struct_begin:n{tag=Link}
- \tag_mc_begin:n{tag=Link}
- \pdfannot_dict_put:nnx
- { link/GoTo }
- { StructParent }
- { \tag_struct_parent_int: }
- }
-
-\hook_gput_code:nnn
- {pdfannot/link/GoTo/after}
- {tagpdf}
- {
- \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:}
- \tag_mc_end:
- \tag_struct_end:
- \tag_mc_begin_pop:n{}
-
- }
-
-\pdfannot_dict_put:nnn
- { link/URI }
- { Contents }
- { (url) }
-
-\pdfannot_dict_put:nnn
- { link/GoTo }
- { Contents }
- { (ref) }
-
%% File: tagpdf-mc.dtx
\newcounter { g__tag_MCID_abs_int }
@@ -1775,7 +1380,8 @@
ParentTreeNextKey, % optional
RoleMap,
ClassMap,
- Namespaces
+ Namespaces,
+ AF %pdf 2.0
}
\seq_const_from_clist:Nn \c__tag_struct_StructElem_entries_seq
@@ -2144,16 +1750,42 @@
{ <\l__tag_tmpa_str> }
},
}
+\cs_new_protected:Npn \__tag_struct_add_AF:nn #1 #2 % #1 struct num #2 object name
+ {
+ \tl_if_exist:cTF
+ {
+ g__tag_struct_#1_AF_tl
+ }
+ {
+ \tl_gput_right:cx
+ { g__tag_struct_#1_AF_tl }
+ { ~ \pdf_object_ref:n {#2} }
+ }
+ {
+ \tl_new:c
+ { g__tag_struct_#1_AF_tl }
+ \tl_gset:cx
+ { g__tag_struct_#1_AF_tl }
+ { \pdf_object_ref:n {#2} }
+ }
+ }
+\cs_generate_variant:Nn \__tag_struct_add_AF:nn {en,ee}
\keys_define:nn { __tag / struct }
{
AF .code:n = % AF property
{
\pdf_object_if_exist:nTF {#1}
{
+ \__tag_struct_add_AF:en { \int_eval:n {\c@g__tag_struct_abs_int} }{#1}
\__tag_prop_gput:cnx
{ g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop }
{ AF }
- { \pdf_object_ref:n {#1} }
+ {
+ [
+ \tl_use:c
+ { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_AF_tl }
+ ]
+ }
}
{
@@ -2163,16 +1795,24 @@
{
\group_begin:
\pdf_object_if_exist:eF {__tag/fileobj\int_use:N\c@g__tag_struct_abs_int}
- {
- \pdffile_embed_stream:nxx
- {#1}
- {tag-AFfile\int_use:N\c@g__tag_struct_abs_int.txt}
- {__tag/fileobj\int_use:N\c@g__tag_struct_abs_int}
- }
- \__tag_prop_gput:cnx
- { g__tag_struct_\int_use:N\c@g__tag_struct_abs_int _prop }
- { AF }
- { \pdf_object_ref:e {__tag/fileobj\int_use:N\c@g__tag_struct_abs_int } }
+ {
+ \pdffile_embed_stream:nxx
+ {#1}
+ {tag-AFfile\int_use:N\c@g__tag_struct_abs_int.txt}
+ {__tag/fileobj\int_use:N\c@g__tag_struct_abs_int}
+ \__tag_struct_add_AF:ee
+ { \int_eval:n {\c@g__tag_struct_abs_int} }
+ { __tag/fileobj\int_use:N\c@g__tag_struct_abs_int }
+ \__tag_prop_gput:cnx
+ { g__tag_struct_\int_use:N\c@g__tag_struct_abs_int _prop }
+ { AF }
+ {
+ [
+ \tl_use:c
+ { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_AF_tl }
+ ]
+ }
+ }
\group_end:
}
,AFinline-o .code:n =
@@ -2184,17 +1824,47 @@
{#1}
{tag-AFfile\int_use:N\c@g__tag_struct_abs_int.txt}
{__tag/fileobj\int_use:N\c@g__tag_struct_abs_int}
+ \__tag_struct_add_AF:ee
+ { \int_eval:n {\c@g__tag_struct_abs_int} }
+ { __tag/fileobj\int_use:N\c@g__tag_struct_abs_int }
+ \__tag_prop_gput:cnx
+ { g__tag_struct_\int_use:N\c@g__tag_struct_abs_int _prop }
+ { AF }
+ {
+ [
+ \tl_use:c
+ { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_AF_tl }
+ ]
+ }
}
- \__tag_prop_gput:cnx
- { g__tag_struct_\int_use:N\c@g__tag_struct_abs_int _prop }
- { AF }
- { \pdf_object_ref:e {__tag/fileobj\int_use:N\c@g__tag_struct_abs_int } }
\group_end:
}
}
+\keys_define:nn { __tag / setup }
+ {
+ root-AF .code:n =
+ {
+ \pdf_object_if_exist:nTF {#1}
+ {
+ \__tag_struct_add_AF:en { 0 }{#1}
+ \__tag_prop_gput:cnx
+ { g__tag_struct_0_prop }
+ { AF }
+ {
+ [
+ \tl_use:c
+ { g__tag_struct_0_AF_tl }
+ ]
+ }
+ }
+ {
+
+ }
+ },
+ }
\cs_new_protected:Npn \tag_struct_begin:n #1 %#1 key-val
{
- \__tag_check_if_active_struct:T
+\__tag_check_if_active_struct:T
{
\group_begin:
\int_gincr:N \c@g__tag_struct_abs_int
@@ -2250,12 +1920,11 @@
\group_end:
}
}
-
\cs_new_protected:Nn \tag_struct_end:
{ %take the current structure num from the stack:
%the objects are written later, lua mode hasn't all needed info yet
%\seq_show:N \g__tag_struct_stack_seq
- \__tag_check_if_active_struct:T
+\__tag_check_if_active_struct:T
{
\seq_gpop:NN \g__tag_struct_tag_stack_seq \l__tag_tmpa_tl
\seq_gpop:NNTF \g__tag_struct_stack_seq \l__tag_tmpa_tl
@@ -2482,6 +2151,446 @@
\group_end:
}
}
+%% File: tagpdf-user.dtx
+
+
+\NewDocumentCommand \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}
+
+ }
+\keys_define:nn { __tag / show }
+ {
+ mc-data .code:n =
+ {
+ \sys_if_engine_luatex:T
+ {
+ \lua_now:e{ltx.__tag.trace.show_all_mc_data(#1,\__tag_get_mc_abs_cnt:,0)}
+ }
+ }
+ ,mc-data .default:n = 1
+ }
+
+\keys_define:nn { __tag / show }
+ { mc-current .code:n =
+ {
+ \bool_if:NTF \g__tag_mode_lua_bool
+ {
+ \sys_if_engine_luatex:T
+ {
+ \int_compare:nNnTF
+ { -2147483647 }
+ =
+ {
+ \lua_now:e
+ {
+ tex.print
+ (tex.getattribute
+ (luatexbase.attributes.g__tag_mc_cnt_attr))
+ }
+ }
+ {
+ \lua_now:e
+ {
+ ltx.__tag.trace.log
+ (
+ "mc-current:~no~MC~open,~current~abscnt
+ =\__tag_get_mc_abs_cnt:"
+ ,0
+ )
+ texio.write_nl("")
+ }
+ }
+ {
+ \lua_now:e
+ {
+ ltx.__tag.trace.log
+ (
+ "mc-current:~abscnt=\__tag_get_mc_abs_cnt:=="
+ ..
+ tex.getattribute(luatexbase.attributes.g__tag_mc_cnt_attr)
+ ..
+ "~=>tag="
+ ..
+ tostring
+ (ltx.__tag.func.get_tag_from
+ (tex.getattribute
+ (luatexbase.attributes.g__tag_mc_type_attr)))
+ ..
+ "="
+ ..
+ tex.getattribute
+ (luatexbase.attributes.g__tag_mc_type_attr)
+ ,0
+ )
+ texio.write_nl("")
+ }
+ }
+ }
+ }
+ {
+ \msg_note:nn{ tag }{ mc-current }
+ }
+ }
+ }
+\keys_define:nn { __tag / show }
+ {
+ mc-marks .choice: ,
+ mc-marks / show .code:n =
+ {
+ \__tag_mc_get_marks:
+ \__tag_check_if_mc_in_galley:TF
+ {
+ \iow_term:n {Marks~from~this~page:~}
+ }
+ {
+ \iow_term:n {Marks~from~a~previous~page:~}
+ }
+ \seq_show:N \l__tag_mc_firstmarks_seq
+ \seq_show:N \l__tag_mc_botmarks_seq
+ \__tag_check_if_mc_tmb_missing:T
+ {
+ \iow_term:n {BDC~missing~on~this~page!}
+ }
+ \__tag_check_if_mc_tme_missing:T
+ {
+ \iow_term:n {EMC~missing~on~this~page!}
+ }
+ },
+ mc-marks / use .code:n =
+ {
+ \__tag_mc_get_marks:
+ \__tag_check_if_mc_in_galley:TF
+ { Marks~from~this~page:~}
+ { Marks~from~a~previous~page:~}
+ \seq_use:Nn \l__tag_mc_firstmarks_seq {,~}\quad
+ \seq_use:Nn \l__tag_mc_botmarks_seq {,~}\quad
+ \__tag_check_if_mc_tmb_missing:T
+ {
+ BDC~missing~
+ }
+ \__tag_check_if_mc_tme_missing:T
+ {
+ EMC~missing
+ }
+ },
+ mc-marks .default:n = show
+ }
+\keys_define:nn { __tag / show }
+ {
+ struct-stack .choice:
+ ,struct-stack / log .code:n = \seq_log:N \g__tag_struct_tag_stack_seq
+ ,struct-stack / show .code:n = \seq_show:N \g__tag_struct_tag_stack_seq
+ ,struct-stack .default:n = show
+ }
+\cs_new_protected:Npn \__tag_add_document_structure:n #1
+ {
+ \hook_gput_code:nnn{begindocument}{tagpdf}{\tagstructbegin{tag=#1}}
+ \hook_gput_code:nnn{tagpdf/finish/before}{tagpdf}{\tagstructend}
+ }
+\keys_define:nn { __tag / setup}
+ {
+ activate .code:n =
+ {
+ \keys_set:nn { __tag / setup }
+ { activate-mc,activate-tree,activate-struct }
+ \__tag_add_document_structure:n {#1}
+ },
+ activate .default:n = Document
+ }
+\AddToHook{begindocument/before}
+ {
+ \bool_lazy_all:nT
+ {
+ { \g__tag_active_struct_dest_bool }
+ { \g__tag_active_struct_bool }
+ { \cs_if_exist_p:N \pdf_activate_structure_destination: }
+ { ! \pdf_version_compare_p:Nn < {2.0} }
+ }
+ {
+ \tl_set:Nn \l_pdf_current_structure_destination_tl { __tag/struct/\g__tag_struct_stack_current_tl }
+ \pdf_activate_structure_destination:
+ }
+ }
+
+\sys_if_engine_luatex:T
+ {
+ \NewDocumentCommand\pdffakespace { }
+ {
+ \__tag_fakespace:
+ }
+ }
+\bool_new:N \l__tag_para_bool
+\bool_new:N \l__tag_para_show_bool
+\int_new:N \g__tag_para_begin_int
+\int_new:N \g__tag_para_end_int
+\keys_define:nn { __tag / setup }
+ {
+ paratagging .bool_set:N = \l__tag_para_bool,
+ paratagging-show .bool_set:N = \l__tag_para_show_bool,
+ }
+
+\AddToHook{para/begin}
+ {
+ \bool_if:NT \l__tag_para_bool
+ {
+ \int_gincr:N \g__tag_para_begin_int
+ \tag_struct_begin:n {tag=P}
+ \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}
+ }
+ }
+\AddToHook{para/end}
+ {
+ \bool_if:NT \l__tag_para_bool
+ {
+ \int_gincr:N \g__tag_para_end_int
+ \tag_mc_end:
+ \bool_if:NT \l__tag_para_show_bool
+ { \tag_mc_begin:n{artifact}
+ \rlap{\color_select:n{red}\tiny\ \int_use:N\g__tag_para_end_int}
+ \tag_mc_end:
+ }
+ \tag_struct_end:
+ }
+ }
+\AddToHook{enddocument/info}
+ {
+ \int_compare:nNnF {\g__tag_para_begin_int}={\g__tag_para_end_int}
+ {
+ \msg_error:nnxx
+ {tag}
+ {para-hook-count-wrong}
+ {\int_use:N\g__tag_para_begin_int}
+ {\int_use:N\g__tag_para_end_int}
+ }
+ }
+\AddToHook{begindocument/before}
+ {
+ \bool_if:NF \g__tag_mode_lua_bool
+ {
+ \cs_if_exist:NT \@kernel@before@footins
+ {
+ \tl_put_right:Nn \@kernel@before@footins
+ { \__tag_add_missing_mcs_to_stream:Nn \footins {footnote} }
+ \tl_put_right:Nn \@kernel@before@cclv
+ {
+ \__tag_check_typeout_v:n {====>~In~\token_to_str:N \@makecol\c_space_tl\the\c@page}
+ \__tag_add_missing_mcs_to_stream:Nn \@cclv {main}
+ }
+ \tl_put_right:Nn \@mult@ptagging@hook
+ {
+ \__tag_check_typeout_v:n {====>~In~\string\page@sofar}
+ \process@cols\mult@firstbox
+ {
+ \__tag_add_missing_mcs_to_stream:Nn \count@ {multicol}
+ }
+ \__tag_add_missing_mcs_to_stream:Nn \mult@rightbox {multicol}
+ }
+ }
+ }
+ }
+\newcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool}
+\newcommand\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:{}
+\cs_new_protected:Npn\__tag_hook_kernel_after_head:{}
+\cs_new_protected:Npn\__tag_hook_kernel_before_foot:{}
+\cs_new_protected:Npn\__tag_hook_kernel_after_foot:{}
+
+\AddToHook{begindocument}
+ {
+ \cs_if_exist:NT \@kernel@before@head
+ {
+ \tl_put_right:Nn \@kernel@before@head {\__tag_hook_kernel_before_head:}
+ \tl_put_left:Nn \@kernel@after@head {\__tag_hook_kernel_after_head:}
+ \tl_put_right:Nn \@kernel@before@foot {\__tag_hook_kernel_before_foot:}
+ \tl_put_left:Nn \@kernel@after@foot {\__tag_hook_kernel_after_foot:}
+ }
+ }
+
+\bool_new:N \g__tag_saved_in_mc_bool
+\cs_new_protected:Npn \__tag_exclude_headfoot_begin:
+ {
+ \bool_set_false:N \l__tag_para_bool
+ \bool_if:NTF \g__tag_mode_lua_bool
+ {
+ \tag_mc_end_push:
+ }
+ {
+ \bool_gset_eq:NN \g__tag_saved_in_mc_bool \g__tag_in_mc_bool
+ \bool_gset_false:N \g__tag_in_mc_bool
+ }
+ \tag_mc_begin:n {artifact}
+ }
+\cs_new_protected:Npn \__tag_exclude_headfoot_end:
+ {
+ \tag_mc_end:
+ \bool_if:NTF \g__tag_mode_lua_bool
+ {
+ \tag_mc_begin_pop:n{}
+ }
+ {
+ \bool_gset_eq:NN \g__tag_in_mc_bool\g__tag_saved_in_mc_bool
+ }
+ }
+\__tag_attr_new_entry:nn {__tag/attr/pagination}{/O/Artifact/Type/Pagination}
+\cs_new_protected:Npn \__tag_exclude_struct_headfoot_begin:n #1
+ {
+ \bool_set_false:N \l__tag_para_bool
+ \bool_if:NTF \g__tag_mode_lua_bool
+ {
+ \tag_mc_end_push:
+ }
+ {
+ \bool_gset_eq:NN \g__tag_saved_in_mc_bool \g__tag_in_mc_bool
+ \bool_gset_false:N \g__tag_in_mc_bool
+ }
+ \tag_struct_begin:n{tag=Artifact,attribute-class=__tag/attr/#1}
+ \tag_mc_begin:n {artifact=#1}
+ }
+
+\cs_new_protected:Npn \__tag_exclude_struct_headfoot_end:
+ {
+ \tag_mc_end:
+ \tag_struct_end:
+ \bool_if:NTF \g__tag_mode_lua_bool
+ {
+ \tag_mc_begin_pop:n{}
+ }
+ {
+ \bool_gset_eq:NN \g__tag_in_mc_bool\g__tag_saved_in_mc_bool
+ }
+ }
+\keys_define:nn { __tag / setup }
+ {
+ exclude-header-footer .choice:,
+ exclude-header-footer / true .code:n =
+ {
+ \cs_set_eq:NN \__tag_hook_kernel_before_head: \__tag_exclude_headfoot_begin:
+ \cs_set_eq:NN \__tag_hook_kernel_before_foot: \__tag_exclude_headfoot_begin:
+ \cs_set_eq:NN \__tag_hook_kernel_after_head: \__tag_exclude_headfoot_end:
+ \cs_set_eq:NN \__tag_hook_kernel_after_foot: \__tag_exclude_headfoot_end:
+ },
+ exclude-header-footer / pagination .code:n =
+ {
+ \cs_set:Nn \__tag_hook_kernel_before_head: { \__tag_exclude_struct_headfoot_begin:n {pagination} }
+ \cs_set:Nn \__tag_hook_kernel_before_foot: { \__tag_exclude_struct_headfoot_begin:n {pagination} }
+ \cs_set_eq:NN \__tag_hook_kernel_after_head: \__tag_exclude_struct_headfoot_end:
+ \cs_set_eq:NN \__tag_hook_kernel_after_foot: \__tag_exclude_struct_headfoot_end:
+ },
+ exclude-header-footer / false .code:n =
+ {
+ \cs_set_eq:NN \__tag_hook_kernel_before_head: \prg_do_nothing:
+ \cs_set_eq:NN \__tag_hook_kernel_before_foot: \prg_do_nothing:
+ \cs_set_eq:NN \__tag_hook_kernel_after_head: \prg_do_nothing:
+ \cs_set_eq:NN \__tag_hook_kernel_after_foot: \prg_do_nothing:
+ },
+ exclude-header-footer .default:n = true,
+ exclude-header-footer .initial:n = true
+ }
+\hook_gput_code:nnn
+ {pdfannot/link/URI/before}
+ {tagpdf}
+ {
+ \tag_mc_end_push:
+ \tag_struct_begin:n { tag=Link }
+ \tag_mc_begin:n { tag=Link }
+ \pdfannot_dict_put:nnx
+ { link/URI }
+ { StructParent }
+ { \tag_struct_parent_int: }
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/URI/after}
+ {tagpdf}
+ {
+ \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:}
+ \tag_mc_end:
+ \tag_struct_end:
+ \tag_mc_begin_pop:n{}
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/GoTo/before}
+ {tagpdf}
+ {
+ \tag_mc_end_push:
+ \tag_struct_begin:n{tag=Link}
+ \tag_mc_begin:n{tag=Link}
+ \pdfannot_dict_put:nnx
+ { link/GoTo }
+ { StructParent }
+ { \tag_struct_parent_int: }
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/GoTo/after}
+ {tagpdf}
+ {
+ \tag_struct_insert_annot:xx {\pdfannot_link_ref_last:}{\tag_struct_parent_int:}
+ \tag_mc_end:
+ \tag_struct_end:
+ \tag_mc_begin_pop:n{}
+
+ }
+
+\pdfannot_dict_put:nnn
+ { link/URI }
+ { Contents }
+ { (url) }
+
+\pdfannot_dict_put:nnn
+ { link/GoTo }
+ { Contents }
+ { (ref) }
+
%%
%%
%% End of file `tagpdf.sty'.
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
index 6ba1ee8d3f3..3c283a8a3e3 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
@@ -1,55 +1,7 @@
%\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2021-08-27} {0.92}
+\ProvidesExplPackage {tagpdfdocu-patches} {2022-01-13} {0.93}
{patches/commands for the tagpdf documentation}
\RequirePackage{etoolbox}
-%%%%
-% header and footer (now needed as attributes are global again)
-%%%%
-%% patching \@oddfoot/\@oddhead is nonsense, that is redefined all the time.
-%% Using the scrlayer interfaces would probably work
-%% but we will need a core latex solution anyway
-%% so let's test it here and patch \@outputpage
-%% we also disable paratagging, not for the tagging but to avoid that the small
-%% numbers gives overfull vbox messages ...
-\bool_new:N \g__tag_docu_saved_in_mc_bool
-\patchcmd\@outputpage
- {\hb@xt@\textwidth{\@thehead}}
- {
- \hb@xt@\textwidth
- {
- \bool_set_false:N \l__tag_para_bool
- \bool_gset_eq:NN \g__tag_docu_saved_in_mc_bool \g__tag_in_mc_bool
- \bool_gset_false:N \g__tag_in_mc_bool
- \hfil
- \tag_mc_begin:n {artifact=pagination}
- \tag_stop_group_begin:
- \@thehead
- \tag_stop_group_end:
- \tag_mc_end:
- \bool_gset_eq:NN \g__tag_in_mc_bool\g__tag_docu_saved_in_mc_bool
- \hfil
- }
- }
- {}{\fail}
-\patchcmd\@outputpage
- {\hb@xt@\textwidth{\@thefoot}}
- {
- \hb@xt@\textwidth
- {
- \bool_set_false:N \l__tag_para_bool
- \bool_gset_eq:NN \g__tag_docu_saved_in_mc_bool \g__tag_in_mc_bool
- \bool_gset_false:N \g__tag_in_mc_bool
- \hfil
- \tag_mc_begin:n {artifact=pagination}
- \tag_stop_group_begin:
- \@thefoot
- \tag_stop_group_end:
- \tag_mc_end:
- \bool_gset_eq:NN \g__tag_in_mc_bool\g__tag_docu_saved_in_mc_bool
- \hfil
- }
- }
- {}{\fail}
%%%%%
% tableofcontents