summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tagpdf
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-15 20:37:46 +0000
committerKarl Berry <karl@freefriends.org>2021-05-15 20:37:46 +0000
commit449b126a17ce3ea3c78f166b93b59470ffa01abf (patch)
tree6e5985ca4eec7a1b2ca662e1f1ec9eae67753031 /Master/texmf-dist/tex/latex/tagpdf
parente04026bae8d6038a4ba422e41af58d1743178733 (diff)
tagpdf (15may21)
git-svn-id: svn://tug.org/texlive/trunk@59214 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tagpdf')
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-attr-code.sty2
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-checks-code.sty33
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def41
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty11
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty10
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-shared.sty33
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def2
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-roles-code.sty464
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-space-code.sty2
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty83
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty72
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf-user.sty194
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua18
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty15
-rw-r--r--Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty308
15 files changed, 932 insertions, 356 deletions
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-attr-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-attr-code.sty
index 03bfb78a98d..dcb382f02c6 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-attr-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-attr-code.sty
@@ -20,7 +20,7 @@
%%
%% File: tagpdf-struct.dtx
-\ProvidesExplPackage {tagpdf-attr-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-attr-code} {2021/05/14} {0.81}
{part of tagpdf - code related to attributes and attribute classes}
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-checks-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-checks-code.sty
index d11f1fdda2f..c94593e5fa1 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-checks-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-checks-code.sty
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-checks.dtx
-\ProvidesExplPackage {tagpdf-checks-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-checks-code} {2021/05/14} {0.81}
{part of tagpdf - code related to checks and messages}
@@ -28,6 +28,8 @@
\msg_new:nnn { tag } {mc-label-unknown} { label~#1~unknown~-~rerun }
\msg_new:nnn { tag } {mc-used-twice} { mc~#1~has~been~already~used }
\msg_new:nnn { tag } {mc-not-open} { there~is~no~mc~to~end~at~#1 }
+\msg_new:nnn { tag } {mc-pushed} { #1~has~been~pushed~to~the~mc~stack}
+\msg_new:nnn { tag } {mc-popped} { #1~has~been~removed~from~the~mc~stack }
\msg_new:nnn { tag } {struct-no-objnum} { objnum~missing~for~structure~#1 }
\msg_new:nnn { tag } {struct-faulty-nesting} { there~is~no~open~structure~on~the~stack }
@@ -41,7 +43,8 @@
\msg_new:nnn { tag } {role-missing} { tag~#1~has~no~role~assigned }
\msg_new:nnn { tag } {role-unknown} { role~#1~is~not~known }
\msg_new:nnn { tag } {role-unknown-tag} { tag~#1~is~not~known }
-\msg_new:nnn { tag } {role-new-tag} { adding~new~tag~#1~mapped~to~role~#2 }
+\msg_new:nnn { tag } {role-tag} { mapping~tag~#1~to~role~#2 }
+\msg_new:nnn { tag } {new-tag} { adding~new~tag~#1 }
\msg_new:nnn { tag } {tree-mcid-index-wrong} {something~is~wrong~with~the~mcid}
@@ -67,6 +70,15 @@
}
}
+\cs_new:Nn \__tag_check_structure_tag:NN %_protected?
+ {
+ \exp_args:NNx
+ \prop_if_in:NnF \g__tag_role_tags_prop {#1/#2}
+ {
+ \msg_warning:nnx { tag } {role-unknown-tag} {#1}
+ }
+ }
+
\cs_new_protected:Nn \__tag_check_info_closing_struct:n %#1 struct num
{
\msg_info:nnn { tag } {struct-show-closing} {#1}
@@ -100,7 +112,7 @@
{
\prop_get:NnNTF \g__tag_role_tags_prop {#2} \l_tmpa_tl
{
- \msg_info:nnnn { tag } {role-new-tag} {#1} {#2}
+ \msg_info:nnnn { tag } {role-tag} {#1} {#2}
}
{
\msg_warning:nnn { tag } {role-unknown} {#2}
@@ -124,13 +136,26 @@
}
}
+\cs_new_protected:Nn \__tag_check_mc_pushed_popped:nn
+ {
+ \int_compare:nNnT
+ { \l__tag_loglevel_int } ={ 2 }
+ { \msg_info:nnx {tag}{mc-#1}{#2} }
+ \int_compare:nNnT
+ { \l__tag_loglevel_int } > { 2 }
+ {
+ \msg_warning:nnx {tag}{mc-#1}{#2}
+ \seq_log:N \g__tag_mc_stack_seq
+ }
+ }
+
\cs_new:Nn \__tag_check_mc_tag:N %protected??
{
\tl_if_empty:NT #1
{
\msg_error:nnx { tag } {mc-tag-missing} { \__tag_get_mc_abs_cnt: }
}
- \prop_if_in:NoF \g__tag_role_tags_prop {#1}
+ \prop_if_in:NoF \g__tag_role_tags_NS_prop {#1}
{
\msg_warning:nnx { tag } {role-unknown-tag} {#1}
}
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
index d1f772d4279..7ce0ccbd05b 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} {2021/02/23} {0.80}
+\ProvidesExplFile {tagpdf-luatex.def} {2021/05/14} {0.81}
{tagpdf~driver~for~luatex}
\newattribute \l__tag_mc_type_attr %the value represent the type
@@ -37,37 +37,28 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\cs_new:Nn \__tag_luatex_get_table_name:Nn
- {
- \tl_set_rescan:Nnn #1 { \char_set_catcode_ignore:N \\ } { #2 }
- }
-
-\cs_new:Nn \__tag_prop_new:N
+\cs_new_protected:Nn \__tag_prop_new:N
{
\prop_new:N #1
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua { ltx.__tag.tables.\l_tmpa_tl = {} }
+ \directlua { ltx.__tag.tables.\cs_to_str:N#1 = {} }
}
-\cs_new:Nn \__tag_seq_new:N
+\cs_new_protected:Nn \__tag_seq_new:N
{
\seq_new:N #1
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua { ltx.__tag.tables.\l_tmpa_tl = {} }
+ \directlua { ltx.__tag.tables.\cs_to_str:N#1 = {} }
}
-\cs_new:Nn \__tag_prop_gput:Nnn
+\cs_new_protected:Nn \__tag_prop_gput:Nnn
{
\prop_gput:Nnn #1 { #2 } { #3 }
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua { ltx.__tag.tables.\l_tmpa_tl["#2"] = "#3" }
+ \directlua { ltx.__tag.tables.\cs_to_str:N#1 ["#2"] = "#3" }
}
-\cs_new:Nn \__tag_seq_gput_right:Nn
+\cs_new_protected:Nn \__tag_seq_gput_right:Nn
{
\seq_gput_right:Nn #1 { #2 }
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua { table.insert(ltx.__tag.tables.\l_tmpa_tl, "#2") }
+ \directlua { table.insert(ltx.__tag.tables.\cs_to_str:N#1, "#2") }
}
@@ -81,20 +72,18 @@
\directlua { tex.print(ltx.__tag.tables.#1["#2"]) }
}
-\cs_new:Nn \__tag_seq_show:N
+\cs_new_protected:Nn \__tag_seq_show:N
{
\seq_show:N #1
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua { ltx.__tag.trace.log ("lua~sequence~array~\l_tmpa_tl",1) }
- \directlua { ltx.__tag.trace.show_seq (ltx.__tag.tables.\l_tmpa_tl) }
+ \directlua { ltx.__tag.trace.log ("lua~sequence~array~\cs_to_str:N#1",1) }
+ \directlua { ltx.__tag.trace.show_seq (ltx.__tag.tables.\cs_to_str:N#1) }
}
-\cs_new:Nn \__tag_prop_show:N
+\cs_new_protected:Nn \__tag_prop_show:N
{
\prop_show:N #1
- \__tag_luatex_get_table_name:Nn \l_tmpa_tl { #1 }
- \directlua {ltx.__tag.trace.log ("lua~property~table~\l_tmpa_tl",1) }
- \directlua {ltx.__tag.trace.show_prop (ltx.__tag.tables.\l_tmpa_tl) }
+ \directlua {ltx.__tag.trace.log ("lua~property~table~\cs_to_str:N#1",1) }
+ \directlua {ltx.__tag.trace.show_prop (ltx.__tag.tables.\cs_to_str:N#1) }
}
%%
%%
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 984df8a986a..6b0a4a033fc 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.dtx
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2021/05/14} {0.81}
{part of tagpdf - code related to marking chunks - generic mode}
@@ -36,8 +36,6 @@
\prg_new_eq_conditional:NNn \tag_mc_if_in: \__tag_mc_if_in: {p,T,F,TF}
-\prg_new_eq_conditional:NNn \uftag_mc_if_in: \__tag_mc_if_in: {p,T,F,TF}
-
\cs_new_protected:Nn \__tag_mc_bmc:n
{
\pdf_bmc:n {#1}
@@ -240,8 +238,6 @@
\group_end:
}
-\cs_set_eq:NN \uftag_mc_begin:n \tag_mc_begin:n
-
\cs_new_protected:Nn \tag_mc_end:
{
\__tag_check_mc_if_open:
@@ -250,8 +246,6 @@
\__tag_mc_emc:
}
-\cs_set_eq:NN \uftag_mc_end: \tag_mc_end:
-
\cs_new_protected:Nn \tag_mc_use:n %#1: label name
{
\tl_set:Nx \l_tmpa_tl { \__tag_ref_value:enn{tagpdf-#1}{tagmcabs}{} }
@@ -278,10 +272,7 @@
}
}
-\cs_set_eq:NN \uftag_mc_use:n \tag_mc_use:n
-
\cs_new:Nn \__tag_get_data_mc_tag: { \g__tag_mc_key_tag_tl }
-
%%
%%
%% End of file `tagpdf-mc-code-generic.sty'.
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 d55366eed6b..23c7c746153 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.dtx
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2021/05/14} {0.81}
{tagpdf - mc code only for the luamode }
@@ -63,8 +63,6 @@
\prg_new_eq_conditional:NNn \tag_mc_if_in: \__tag_mc_if_in: {p,T,F,TF}
-\prg_new_eq_conditional:NNn \uftag_mc_if_in: \__tag_mc_if_in: {p,T,F,TF}
-
\tl_new:N \l__tag_mc_key_tag_tl
\tl_new:N \l__tag_mc_key_label_tl
\tl_new:N \l__tag_mc_key_properties_tl
@@ -294,8 +292,6 @@
%\group_end:
}
-\cs_set_eq:NN \uftag_mc_begin:n \tag_mc_begin:n
-
\cs_new_protected:Nn \tag_mc_end:
{
%\__tag_check_mc_if_open:
@@ -305,8 +301,6 @@
\tl_set:Nn \l__tag_mc_key_tag_tl { }
}
-\cs_set_eq:NN \uftag_mc_end: \tag_mc_end:
-
\cs_new_protected:Nn \tag_mc_use:n %#1: label name
{
\tl_set:Nx \l_tmpa_tl { \__tag_ref_value:enn{tagpdf-#1}{tagmcabs}{} }
@@ -319,8 +313,6 @@
}
}
-\cs_set_eq:NN \uftag_mc_use:n \tag_mc_use:n
-
\cs_new:Nn \__tag_get_data_mc_tag: { \l__tag_mc_key_tag_tl }
%%
%%
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-shared.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-shared.sty
index 49cfbaf69df..7a7fb156ad7 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-shared.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-shared.sty
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-mc.dtx
-\ProvidesExplPackage {tagpdf-mc-code-shared} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-mc-code-shared} {2021/05/14} {0.81}
{part of tagpdf - code related to marking chunks -
code shared by generic and luamode }
@@ -34,6 +34,7 @@
\__tag_prop_new:N \g__tag_mc_parenttree_prop
+\seq_new:N \g__tag_mc_stack_seq
\tl_new:N \l__tag_mc_artifact_type_tl
\keys_define:nn { __tag / mc }
@@ -81,6 +82,36 @@
\int_new:N \g__tag_MCID_tmp_bypage_int
+
+\cs_new_protected:Npn \tag_mc_end_push:
+ {
+ \__tag_mc_if_in:TF
+ {
+ \seq_gpush:Nx \g__tag_mc_stack_seq { \tag_get:n {mc_tag} }
+ \__tag_check_mc_pushed_popped:nn {pushed}{\tag_get:n {mc_tag}}
+ \tag_mc_end:
+ }
+ {
+ \__tag_check_mc_pushed_popped:nn {pushed}{-1}
+ \seq_gpush:Nn \g__tag_mc_stack_seq{ -1 }
+ }
+ }
+\cs_new_protected:Npn \tag_mc_begin_pop:n #1
+ {
+ \seq_gpop:NNTF \g__tag_mc_stack_seq \l__tag_tmpa_tl
+ {
+ \tl_if_eq:NnTF \l__tag_tmpa_tl {-1}
+ {
+ \__tag_check_mc_pushed_popped:nn {popped}{-1}
+ }
+ {
+ \__tag_check_mc_pushed_popped:nn {popped}{\l__tag_tmpa_tl}
+ \tag_mc_begin:n {tag=\l__tag_tmpa_tl,#1}
+ }
+ }
+ { \__tag_check_mc_pushed_popped:nn {popped}{empty~stack,~nothing} } %message?
+ }
+
%%
%%
%% End of file `tagpdf-mc-code-shared.sty'.
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def
index ab40b3de3a0..cda376c56e6 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-pdftex.def} {2021/02/23} {0.80}
+\ProvidesExplFile {tagpdf-pdftex.def} {2021/05/14} {0.81}
{tagpdf~driver~for~pdftex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-roles-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-roles-code.sty
index a205e057e36..e7bcea87af1 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-roles-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-roles-code.sty
@@ -19,29 +19,63 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-roles.dtx
-\ProvidesExplPackage {tagpdf-roles-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-roles-code} {2021/05/14} {0.81}
{part of tagpdf - code related to roles and structure names}
-
-\__tag_seq_new:N \g__tag_role_tags_seq %to get names from numbers
-\__tag_prop_new:N \g__tag_role_tags_prop %to get numbers from names
-
-\clist_const:Nn \c__tag_role_sttags_clist
- {%possible root elements
+\__tag_seq_new:N \g__tag_role_tags_seq %to get names (type/NS) from numbers
+\__tag_prop_new:N \g__tag_role_tags_prop %to get numbers from names (type/NS)
+\prop_new:N \g__tag_role_tags_NS_prop %to namespace info
+\prop_new:N \g__tag_role_NS_prop % collect namespaces
+\cs_new_protected:Npn \__tag_role_NS_new:nnn #1 #2 #3
+ { \msg_redirect_name:nnn { pdfdict } { empty-value } { none }
+ \pdf_object_new:nn {tag/NS/#1}{dict}
+ \pdfdict_new:n {g__tag_role/Namespace_#1_dict}
+ \pdf_object_new:nn {__tag/RoleMapNS/#1}{dict}
+ \pdfdict_new:n {g__tag_role/RoleMapNS_#1_dict}
+ \pdfdict_gput:nnn
+ {g__tag_role/Namespace_#1_dict}
+ {Type}
+ {/Namespace}
+ \pdf_string_from_unicode:nnN{utf8/string}{#2}\l_tmpa_str
+ \pdfdict_gput:nnx
+ {g__tag_role/Namespace_#1_dict}
+ {NS}
+ {\l_tmpa_str}
+ %RoleMapNS is added in tree
+ \pdfdict_gput:nnx{g__tag_role/Namespace_#1_dict}
+ {Schema}{#3}
+ \prop_gput:Nnx \g__tag_role_NS_prop {#1}{\pdf_object_ref:n{tag/NS/#1}~}
+ \msg_redirect_name:nnn { pdfdict } { empty-value } { warning }
+ }
+\str_const:Nx \c__tag_role_userNS_id_str
+ { data:,
+ \int_to_Hex:n{\int_rand:n {65535}}
+ \int_to_Hex:n{\int_rand:n {65535}}
+ -
+ \int_to_Hex:n{\int_rand:n {65535}}
+ -
+ \int_to_Hex:n{\int_rand:n {65535}}
+ -
+ \int_to_Hex:n{\int_rand:n {65535}}
+ -
+ \int_to_Hex:n{\int_rand:n {16777215}}
+ \int_to_Hex:n{\int_rand:n {16777215}}
+ }
+\pdf_version_compare:NnT > {1.9}
+ {
+ \__tag_role_NS_new:nnn {pdf} {http://iso.org/pdf/ssn}{}
+ \__tag_role_NS_new:nnn {pdf2} {http://iso.org/pdf2/ssn}{}
+ \__tag_role_NS_new:nnn {mathml}{http://www.w3.org/1998/Math/MathML}{}
+ \exp_args:Nnx
+ \__tag_role_NS_new:nnn {user}{\c__tag_role_userNS_id_str}{}
+ }
+\clist_const:Nn \c__tag_role_sttags_pdf_pdfII_clist
+ {
Document, %A complete document. This is the root element of any structure tree containing
%multiple parts or multiple articles.
Part, %A large-scale division of a document.
- Art, %A relatively self-contained body of text constituting a single narrative or exposition
- %subelements
Sect, %A container for grouping related content elements.
Div, %A generic block-level element or group of elements
- BlockQuote, %A portion of text consisting of one or more paragraphs attributed to someone other
- %than the author of the surrounding text.
Caption, %A brief portion of text describing a table or figure.
- TOC, %A list made up of table of contents item entries (structure tag TOCI; see below)
- %and/or other nested table of contents entries
- TOCI, %An individual member of a table of contents. This entry's children can be any of
- %the following structure tags:
- %Lbl,Reference,NonStruct,P,TOC
Index,
NonStruct, %probably not needed
H,
@@ -64,23 +98,288 @@
TBody, %table rows
TFoot, %table footer
Span, %generic inline marker
- Quote, %inline quote
- Note, % footnote, endnote. Lbl can be child
- Reference, % A citation to content elsewhere in the document.
- BibEntry, %bibentry
- Code, %
Link, %
Annot,
Figure,
Formula,
Form,
- Artifact
+ % ruby warichu etc ..
+ Ruby,
+ RB,
+ RT,
+ Warichu,
+ WT,
+ WP,
+ Artifact % only MC-tag ?...
}
+\clist_const:Nn \c__tag_role_sttags_only_pdf_clist
+ {
+ Art,%A relatively self-contained body of text constituting a single narrative or exposition
+ BlockQuote, %A portion of text consisting of one or more paragraphs attributed to someone other
+ %than the author of the surrounding text.
+ TOC, %A list made up of table of contents item entries (structure tag TOCI; see below)
+ %and/or other nested table of contents entries
+ TOCI, %An individual member of a table of contents. This entry's children can be any of
+ %the following structure tags:
+ %Lbl,Reference,NonStruct,P,TOC
+ Index,
+ Private,
+ Quote, %inline quote
+ Note, %footnote, endnote. Lbl can be child
+ Reference, %A citation to content elsewhere in the document.
+ BibEntry, %bibentry
+ Code
+ }
+
+\clist_const:Nn \c__tag_role_sttags_only_pdfII_clist
+ {
+ DocumentFragment
+ ,Aside
+ ,H7
+ ,H8
+ ,H9
+ ,H10
+ ,Title
+ ,FENote
+ ,Sub
+ ,Em
+ ,Strong
+ ,Artifact
+ }
-\clist_map_inline:Nn \c__tag_role_sttags_clist
+\clist_const:Nn \c__tag_role_sttags_mathml_clist
+ {
+ abs
+ ,and
+ ,annotation
+ ,apply
+ ,approx
+ ,arccos
+ ,arccosh
+ ,arccot
+ ,arccoth
+ ,arccsc
+ ,arccsch
+ ,arcsec
+ ,arcsech
+ ,arcsin
+ ,arcsinh
+ ,arctan
+ ,arctanh
+ ,arg
+ ,bind
+ ,bvar
+ ,card
+ ,cartesianproduct
+ ,cbytes
+ ,ceiling
+ ,cerror
+ ,ci
+ ,cn
+ ,codomain
+ ,complexes
+ ,compose
+ ,condition
+ ,conjugate
+ ,cos
+ ,cosh
+ ,cot
+ ,coth
+ ,cs
+ ,csc
+ ,csch
+ ,csymbol
+ ,curl
+ ,declare
+ ,degree
+ ,determinant
+ ,diff
+ ,divergence
+ ,divide
+ ,domain
+ ,domainofapplication
+ ,emptyset
+ ,eq
+ ,equivalent
+ ,eulergamma
+ ,exists
+ ,exp
+ ,exponentiale
+ ,factorial
+ ,factorof
+ ,false
+ ,floor
+ ,fn
+ ,forall
+ ,gcd
+ ,geq
+ ,grad
+ ,gt
+ ,ident
+ ,image
+ ,imaginary
+ ,imaginaryi
+ ,implies
+ ,in
+ ,infinity
+ ,int
+ ,integers
+ ,intersect
+ ,interval
+ ,inverse
+ ,lambda
+ ,laplacian
+ ,lcm
+ ,leq
+ ,limit
+ ,ln
+ ,log
+ ,logbase
+ ,lowlimit
+ ,lt
+ ,maction
+ ,maligngroup
+ ,malignmark
+ ,math
+ ,matrix
+ ,matrixrow
+ ,max
+ ,mean
+ ,median
+ ,menclose
+ ,merror
+ ,mfenced
+ ,mfrac
+ ,mglyph
+ ,mi
+ ,min
+ ,minus
+ ,mlabeledtr
+ ,mlongdiv
+ ,mmultiscripts
+ ,mn
+ ,mo
+ ,mode
+ ,moment
+ ,momentabout
+ ,mover
+ ,mpadded
+ ,mphantom
+ ,mprescripts
+ ,mroot
+ ,mrow
+ ,ms
+ ,mscarries
+ ,mscarry
+ ,msgroup
+ ,msline
+ ,mspace
+ ,msqrt
+ ,msrow
+ ,mstack
+ ,mstyle
+ ,msub
+ ,msubsup
+ ,msup
+ ,mtable
+ ,mtd
+ ,mtext
+ ,mtr
+ ,munder
+ ,munderover
+ ,naturalnumbers
+ ,neq
+ ,none
+ ,not
+ ,notanumber
+ ,notin
+ ,notprsubset
+ ,notsubset
+ ,or
+ ,otherwise
+ ,outerproduct
+ ,partialdiff
+ ,pi
+ ,piece
+ ,piecewise
+ ,plus
+ ,power
+ ,primes
+ ,product
+ ,prsubset
+ ,quotient
+ ,rationals
+ ,real
+ ,reals
+ ,reln
+ ,rem
+ ,root
+ ,scalarproduct
+ ,sdev
+ ,sec
+ ,sech
+ ,selector
+ ,semantics
+ ,sep
+ ,set
+ ,setdiff
+ ,share
+ ,sin
+ ,sinh
+ ,subset
+ ,sum
+ ,tan
+ ,tanh
+ ,tendsto
+ ,times
+ ,transpose
+ ,true
+ ,union
+ ,uplimit
+ ,variance
+ ,vector
+ ,vectorproduct
+ ,xor
+ }
+
+\prop_const_from_keyval:Nn \c__tag_role_sttags_pdfII_to_pdf_prop
+ {
+ DocumentFragment = Art,
+ Aside = Note,
+ Title = H1,
+ Sub = Span,
+ H7 = H6 ,
+ H8 = H6 ,
+ H9 = H6 ,
+ H10 = H6,
+ FENote= Note,
+ Em = Span,
+ Strong= Span,
+ }
+
+\clist_map_inline:Nn \c__tag_role_sttags_pdf_pdfII_clist
+ {
+ \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ pdf2 }
+ }
+\clist_map_inline:Nn \c__tag_role_sttags_only_pdf_clist
+ {
+ \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ pdf }
+ }
+\clist_map_inline:Nn \c__tag_role_sttags_only_pdfII_clist
{
\__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ pdf2 }
+ }
+\pdf_version_compare:NnT > {1.9}
+ {
+ \clist_map_inline:Nn \c__tag_role_sttags_mathml_clist
+ {
+ \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ mathml }
+ }
}
\int_step_inline:nnnn { 1 }{ 1 }{ \seq_count:N \g__tag_role_tags_seq }
@@ -91,50 +390,119 @@
}
{ #1 }
}
-
-\cs_new:Nn \__tag_role_get_tag_from_index:nn
+\pdfdict_new:n {g__tag_role/RoleMap_dict}
+\cs_new_protected:Nn \__tag_role_add_tag:nn %(new) name, reference to old
{
- \__tag_seq_item:cn { #1_seq } { #2 }
+ \prop_if_in:NnF \g__tag_role_tags_prop {#1}
+ {
+ \msg_info:nnn { tag }{new-tag}{#1}
+ \__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
+ \__tag_prop_gput:Nnx \g__tag_role_tags_prop { #1 }
+ {
+ \seq_count:N \g__tag_role_tags_seq
+ }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ user }
+ }
+ %\__tag_check_add_tag_role:nn {#1}{#2} %%!TODO
+ \tl_if_empty:nF { #2 }
+ {
+ \pdfdict_gput:nnx {g__tag_role/RoleMap_dict}
+ {#1}
+ {\pdf_name_from_unicode_e:n{#2}}
+ }
}
+\cs_generate_variant:Nn \__tag_role_add_tag:nn {VV}
-\cs_new:Nn \__tag_role_get_index_from_tag:nn
+\pdf_version_compare:NnT < {2.0}
{
- \__tag_prop_item:cn { #1_prop } { #2 }
+ \prop_map_inline:Nn \c__tag_role_sttags_pdfII_to_pdf_prop
+ {
+ \__tag_role_add_tag:nn {#1}{#2}
+ }
}
-
-\__tag_prop_new:N \g__tag_role_rolemap_prop
-
-\cs_new_protected:Nn \__tag_role_add_tag:nn %new name, reference to old
+\cs_new_protected:Nn \__tag_role_add_tag:nnnn %tag/namespace/role/namespace
{
+ \msg_info:nnn { tag }{new-tag}{#1}
\__tag_seq_gput_right:Nn \g__tag_role_tags_seq { #1 }
\__tag_prop_gput:Nnx \g__tag_role_tags_prop { #1 }
- {
- \seq_count:N \g__tag_role_tags_seq
- }
- \__tag_check_add_tag_role:nn {#1}{#2}
- \tl_if_empty:nF { #2 }
- {
- \__tag_prop_gput:Nnn \g__tag_role_rolemap_prop
- { #1 } { #2 }
- }
- }
+ {
+ \seq_count:N \g__tag_role_tags_seq
+ }
+ \prop_gput:Nnn \g__tag_role_tags_NS_prop { #1 }{ #2 }
+ %\__tag_check_add_tag_role:nn {#1}{#3} %TODO
+ \pdfdict_gput:nnx {g__tag_role/RoleMapNS_#2_dict}{#1}
+ {
+ [
+ \pdf_name_from_unicode_e:n{#3}
+ \c_space_tl
+ \pdf_object_ref:n {tag/NS/#4}
+ ]
+ }
+ }
+\cs_generate_variant:Nn \__tag_role_add_tag:nnnn {VVVV}
-\cs_generate_variant:Nn \__tag_role_add_tag:nn {xx}
+\tl_new:N \l__tag_role_tag_tmpa_tl
+\tl_new:N \l__tag_role_tag_namespace_tmpa_tl
+\tl_new:N \l__tag_role_role_tmpa_tl
+\tl_new:N \l__tag_role_role_namespace_tmpa_tl
+
+\keys_define:nn { __tag / tag-role }
+ {
+ ,tag .tl_set:N = \l__tag_role_tag_tmpa_tl
+ ,tag-namespace .tl_set:N = \l__tag_role_tag_namespace_tmpa_tl
+ ,role .tl_set:N = \l__tag_role_role_tmpa_tl
+ ,role-namespace .tl_set:N = \l__tag_role_role_namespace_tmpa_tl
+ }
\keys_define:nn { __tag / setup }
{
add-new-tag .code:n =
{
- \seq_set_split:Nnn \l_tmpa_seq { / } {#1/}
- \__tag_role_add_tag:xx
+ \keys_set_known:nnnN
+ {__tag/tag-role}
+ {
+ tag-namespace=user,
+ role-namespace=, %so that we can test for it.
+ #1
+ }{__tag/tag-role}\l_tmpa_tl
+ \tl_if_empty:NF \l_tmpa_tl
{
- \seq_item:Nn \l_tmpa_seq {1}
+ \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq { / } {\l_tmpa_tl/}
+ \tl_set:Nx \l__tag_role_tag_tmpa_tl { \seq_item:Nn \l_tmpa_seq {1} }
+ \tl_set:Nx \l__tag_role_role_tmpa_tl { \seq_item:Nn \l_tmpa_seq {2} }
}
+ \tl_if_empty:NT \l__tag_role_role_namespace_tmpa_tl
{
- \seq_item:Nn \l_tmpa_seq {2}
+ \prop_get:NVNTF
+ \g__tag_role_tags_NS_prop
+ \l__tag_role_role_tmpa_tl
+ \l__tag_role_role_namespace_tmpa_tl
+ {
+ \prop_if_in:NVF\g__tag_role_NS_prop \l__tag_role_role_namespace_tmpa_tl
+ {
+ \tl_set:Nn \l__tag_role_role_namespace_tmpa_tl {user}
+ }
+ }
+ {
+ \tl_set:Nn \l__tag_role_role_namespace_tmpa_tl {user}
+ }
}
- }
+ \pdf_version_compare:NnTF < {2.0}
+ {
+ %TODO add check for emptyness?
+ \__tag_role_add_tag:VV
+ \l__tag_role_tag_tmpa_tl
+ \l__tag_role_role_tmpa_tl
+ }
+ {
+ \__tag_role_add_tag:VVVV
+ \l__tag_role_tag_tmpa_tl
+ \l__tag_role_tag_namespace_tmpa_tl
+ \l__tag_role_role_tmpa_tl
+ \l__tag_role_role_namespace_tmpa_tl
+ }
+ }
}
%%
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-space-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-space-code.sty
index bbfee64e8a3..d4cee555290 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-space-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-space-code.sty
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-space.dtx
-\ProvidesExplPackage {tagpdf-space-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-space-code} {2021/05/14} {0.81}
{part of tagpdf - code related to real space chars}
\sys_if_engine_pdftex:T
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
index 8fedc841e17..a70aa3ec850 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-struct-code.sty
@@ -19,25 +19,18 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-struct.dtx
-\ProvidesExplPackage {tagpdf-struct-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-struct-code} {2021/05/14} {0.81}
{part of tagpdf - code related to storing structure}
-
-
\newcounter { g__tag_struct_abs_int }
\int_gzero:N \c@g__tag_struct_abs_int
-
-
-
\__tag_seq_new:N \g__tag_struct_objR_seq
-
\seq_new:N \g__tag_struct_stack_seq
\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 \l__tag_struct_stack_parent_tmp_tl
\tl_new:N \g__tag_struct_stack_current_tl
-
-
\seq_const_from_clist:Nn \c__tag_struct_StructTreeRoot_entries_seq
{%p. 857/858
Type, % always /StructTreeRoot
@@ -46,7 +39,8 @@
ParentTree, % required,obj ref to the parent tree
ParentTreeNextKey, %optional
RoleMap,
- ClassMap
+ ClassMap,
+ Namespaces
}
\seq_const_from_clist:Nn \c__tag_struct_StructElem_entries_seq
@@ -97,13 +91,12 @@
\__tag_seq_new:c { g__tag_struct_kids_0_seq }
-
-\__tag_prop_gput:cno
+\__tag_prop_gput:cnx
{ g__tag_struct_0_prop }
{ objref}
- { \pdf_object_ref:n { c__tag_struct_0_obj } }
+ { \pdf_object_ref:n { __tag/struct/0 } }
-\__tag_prop_gput:cno
+\__tag_prop_gput:cnn
{ g__tag_struct_0_prop }
{ Type }
{ /StructTreeRoot }
@@ -111,23 +104,28 @@
\__tag_prop_gput:cnx
{ g__tag_struct_0_prop }
{ ParentTree }
- { \pdf_object_ref:n { c__tag_tree_parenttree_obj } }
+ { \pdf_object_ref:n { __tag/tree/parenttree } }
\__tag_prop_gput:cnx
{ g__tag_struct_0_prop }
{ RoleMap }
- { \pdf_object_ref:n { c__tag_tree_rolemap_obj } }
+ { \pdf_object_ref:n { __tag/tree/rolemap } }
-\__tag_prop_gput:cno
+\__tag_prop_gput:cnn
{ g__tag_struct_0_prop }
{ entries }
{ StructTreeRoot }
-\__tag_prop_gput:cno
+\__tag_prop_gput:cnn
{ g__tag_struct_0_prop }
{ num }
{ 0 }
+\__tag_prop_gput:cnx
+ { g__tag_struct_0_prop }
+ { Namespaces }
+ { \pdf_object_ref:n { __tag/tree/namespaces } }
+
\cs_new:Nn \__tag_struct_kid_mc_gput_right:nn %#1 structure num, #2 MCID absnum%
{
@@ -269,7 +267,7 @@
\__tag_struct_get_dict_content:n { #1 }
\exp_args:Nx
\pdf_object_write:nx
- { c__tag_struct_#1_obj }
+ { __tag/struct/#1 }
{
\l__tag_struct_dict_content_tl
}
@@ -279,21 +277,42 @@
}
}
+\cs_new:Nn \__tag_get_data_struct_tag:
+ {
+ \exp_args:Ne
+ \tl_tail:n
+ {
+ \prop_item:cn {g__tag_struct_\g__tag_struct_stack_current_tl _prop}{S}
+ }
+ }
+
+\tl_new:N \g__tag_struct_tag_tl
+\tl_new:N \g__tag_struct_tag_NS_tl
+\cs_generate_variant:Nn \seq_set_split:Nnn{Nne}
\keys_define:nn { __tag / struct }
{
label .tl_set:N = \l__tag_struct_key_label_tl,
stash .bool_set:N = \l__tag_struct_elem_stash_bool,
tag .code:n = % S property
- {%%????????? \pdfescapename??
- \tl_set:Nx \l__tag_tmpa_tl { #1 }
+ {%%????????? \pdfescapename?? slash/not slash is here the question ...
+ \seq_set_split:Nne \l_tmpa_seq { / } {#1/\prop_item:Nn\g__tag_role_tags_NS_prop{#1}}
+ \tl_gset:Nx \g__tag_struct_tag_tl { \seq_item:Nn\l_tmpa_seq {1} }
+ \tl_gset:Nx \g__tag_struct_tag_NS_tl { \seq_item:Nn\l_tmpa_seq {2} }
\bool_if:NT \g__tag_check_tags_bool
{
- \__tag_check_structure_tag:N \l__tag_tmpa_tl
+ \__tag_check_structure_tag:N \g__tag_struct_tag_tl
}
\__tag_prop_gput:cnx
{ g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop }
{ S }
- { /\exp_not:V\l__tag_tmpa_tl }
+ { \pdf_name_from_unicode_e:n{ \g__tag_struct_tag_tl} } %
+ \prop_get:NVNT \g__tag_role_NS_prop\g__tag_struct_tag_NS_tl\l__tag_tmpa_tl
+ {
+ \__tag_prop_gput:cnx
+ { g__tag_struct_\int_eval:n {\c@g__tag_struct_abs_int}_prop }
+ { NS }
+ { \l__tag_tmpa_tl } %
+ }
},
title .code:n = % T property
{
@@ -462,7 +481,7 @@
%\__tag_pdfreserveobjnum:N \l_tmpa_tl
\exp_args:Ne
\pdf_object_new:nn
- { c__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_obj }
+ { __tag/struct/\int_eval:n { \c@g__tag_struct_abs_int } }
{ dict }
\__tag_prop_gput:cnx
{ g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop }
@@ -470,7 +489,7 @@
{
\exp_args:Ne
\pdf_object_ref:n
- {c__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_obj}
+ {__tag/struct/\int_eval:n { \c@g__tag_struct_abs_int }}
}
\__tag_prop_gput:cnx
{ g__tag_struct_\int_eval:n { \c@g__tag_struct_abs_int }_prop }
@@ -499,6 +518,7 @@
\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
@@ -526,12 +546,11 @@
\group_end:
}
-\cs_set_eq:NN \uftag_struct_begin:n \tag_struct_begin:n
-
\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
+ \seq_gpop:NN \g__tag_struct_tag_stack_seq \l_tmpa_tl
\seq_gpop:NNTF \g__tag_struct_stack_seq \l_tmpa_tl
{
\int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
@@ -548,10 +567,12 @@
{
\__tag_check_no_open_struck:
}
+ \seq_get:NNT \g__tag_struct_tag_stack_seq \l_tmpa_tl
+ {
+ \tl_gset:NV \g__tag_struct_tag_tl \l_tmpa_tl
+ }
}
-\cs_set_eq:NN \uftag_struct_end: \tag_struct_end:
-
\cs_new_protected:Nn \tag_struct_use:n %#1 is the label
{
\prop_if_exist:cTF
@@ -577,8 +598,6 @@
}
}
-\cs_set_eq:NN \uftag_struct_use:n \tag_struct_use:n
-
%%%% Code to tag links
%%%% this works for url, see exp-link.pdf.
%%%% it must be checked for other links
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
index 390965ae506..258f2818eb6 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
@@ -19,19 +19,25 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf-tree.dtx
-\ProvidesExplPackage {tagpdf-tree-code} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-tree-code} {2021/05/14} {0.81}
{part of tagpdf - code related to writing trees and dictionaries to the pdf}
\hook_gput_code:nnn{begindocument}{tagpdf}
{
\bool_if:NT \g__tag_active_tree_bool
{
- \AfterEndDocument { \tag_finish_structure: }
+ \sys_if_output_pdf:TF
+ {
+ \AddToHook{enddocument/end} { \tag_finish_structure: }
+ }
+ {
+ \AddToHook{shipout/lastpage} { \tag_finish_structure: }
+ }
}
}
-\pdf_object_new:nn { c__tag_struct_0_obj }{ dict }
+\pdf_object_new:nn { __tag/struct/0 }{ dict }
%need to think about the best place ...
\hook_gput_code:nnn{begindocument}{tagpdf}
@@ -41,7 +47,7 @@
\pdfmanagement_add:nnx
{ Catalog }
{ StructTreeRoot }
- { \pdf_object_ref:n { c__tag_struct_0_obj } }
+ { \pdf_object_ref:n { __tag/struct/0 } }
}
}
\cs_new_protected:Nn \__tag_tree_write_structtreeroot:
@@ -59,7 +65,7 @@
}
-\pdf_object_new:nn { c__tag_tree_parenttree_obj }{ dict }
+\pdf_object_new:nn { __tag/tree/parenttree }{ dict }
\newcounter { g__tag_parenttree_obj_int }
\hook_gput_code:nnn{begindocument}{tagpdf}
@@ -155,34 +161,20 @@
\__tag_tree_fill_parenttree:
}
\tl_put_right:NV \l__tag_parenttree_content_tl\g__tag_parenttree_objr_tl
- \pdf_object_write:nx { c__tag_tree_parenttree_obj }
+ \pdf_object_write:nx { __tag/tree/parenttree }
{
/Nums\c_space_tl [\l__tag_parenttree_content_tl]
}
}
-\pdf_object_new:nn { c__tag_tree_rolemap_obj }{ dict }
-
-\tl_new:N \l__tag_rolemap_content_tl
-
-\cs_new_protected:Nn \__tag_tree_fill_rolemap:
- {
- \prop_map_inline:Nn \g__tag_role_rolemap_prop
- {
- \tl_put_right:Nx \l__tag_rolemap_content_tl
- {
- /##1\c_space_tl/##2^^J
- }
- }
- }
+\pdf_object_new:nn { __tag/tree/rolemap }{ dict }
\cs_new_protected:Nn \__tag_tree_write_rolemap:
{
- \__tag_tree_fill_rolemap:
- \pdf_object_write:nx { c__tag_tree_rolemap_obj }
+ \pdf_object_write:nx { __tag/tree/rolemap }
{
- \l__tag_rolemap_content_tl
+ \pdfdict_use:n{g__tag_role/RoleMap_dict}
}
}
@@ -209,16 +201,41 @@
\tl_if_empty:NF
\g__tag_attr_class_content_tl
{
- \pdf_object_new:nn { c__tag_tree_classmap_obj }{ dict }
+ \pdf_object_new:nn { __tag/tree/classmap }{ dict }
% \__tag_pdfreserveobjnum:N \l_tmpa_tl
% \tl_const:Nx \c__tag_tree_obj_classmap_tl { \l_tmpa_tl }
\pdf_object_write:nx
- { c__tag_tree_classmap_obj }
+ { __tag/tree/classmap }
{ \g__tag_attr_class_content_tl }
\__tag_prop_gput:cnx
{ g__tag_struct_0_prop }
{ ClassMap }
- { \pdf_object_ref:n { c__tag_tree_classmap_obj } }
+ { \pdf_object_ref:n { __tag/tree/classmap } }
+ }
+ }
+
+\pdf_object_new:nn{ __tag/tree/namespaces }{array}
+\cs_new_protected:Npn \__tag_tree_write_namespaces:
+ {
+ \prop_map_inline:Nn \g__tag_role_NS_prop
+ {
+ \pdfdict_if_empty:nF {g__tag_role/RoleMapNS_##1_dict}
+ {
+ \pdf_object_write: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}
+ {
+ \pdfdict_use:n {g__tag_role/Namespace_##1_dict}
+ }
+ }
+ \pdf_object_write:nx {__tag/tree/namespaces}
+ {
+ \prop_map_tokens:Nn \g__tag_role_NS_prop{\use_ii:nn}
}
}
@@ -227,12 +244,11 @@
\__tag_tree_write_parenttree:
\__tag_tree_write_rolemap:
\__tag_tree_write_classmap:
+ \__tag_tree_write_namespaces:
\__tag_tree_write_structelements: %this is rather slow!!
\__tag_tree_write_structtreeroot:
}
-\cs_set_eq:NN \uftag_finish_structure: \tag_finish_structure:
-
\hook_gput_code:nnn{begindocument}{tagpdf}
{
\bool_if:NT\g__tag_active_tree_bool
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-user.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-user.sty
index 8d2569a879b..b52a3e0f31f 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-user.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-user.sty
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-user} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf-user} {2021/05/14} {0.81}
{tagpdf - user commands}
\NewDocumentCommand \tagpdfsetup { m }
@@ -30,8 +30,6 @@
\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
-
-%%% stop tagging
\bool_new:N \l__tag_stop_bool
\prg_new_conditional:Nnn \__tag_if_stop: {p,T,F,TF}
@@ -52,13 +50,6 @@
\cs_set_eq:NN \tag_struct_begin:n \use_none:n
\cs_set_eq:NN \tag_struct_end: \prg_do_nothing:
\cs_set_eq:NN \tag_struct_use:n \use_none:n
- %deprecated
- \cs_set_eq:NN \uftag_mc_begin:n \tag_mc_begin:n
- \cs_set_eq:NN \uftag_mc_end: \tag_mc_end:
- \cs_set_eq:NN \uftag_mc_use:n \tag_mc_use:n
- \cs_set_eq:NN \uftag_struct_begin:n \tag_struct_begin:n
- \cs_set_eq:NN \uftag_struct_end: \tag_struct_end:
- \cs_set_eq:NN \uftag_struct_use:n \tag_struct_use:n
}
\cs_new_protected:Npn \tag_stop_group_begin:
@@ -68,19 +59,13 @@
}
\cs_set_eq:NN \tag_stop_group_end: \group_end:
-
-%%% a generic command to retrieve data
-
\cs_new:Npn \tagpdfget #1 { \use:c {__tag_get_data_#1: } }
\cs_new:Npn \tag_get:n #1 { \use:c {__tag_get_data_#1: } }
-\cs_new:Npn \uftag_get:n #1 { \use:c {__tag_get_data_#1: } }
-%%%% mc related user commands
\NewDocumentCommand \tagmcifinTF { m m }
{
\__tag_mc_if_in:TF { #1 } { #2 }
}
-
\NewDocumentEnvironment{tagmcartifact}{m}
{
\tag_mc_artifact_group_begin:n { #1}\ignorespaces
@@ -96,7 +81,7 @@
\NewDocumentCommand \tagmcend { }
{
- \unskip % this unskip appears to mess up some spacing; can we do this in another way?
+ \if_mode_horizontal: \unskip \fi: %
\tag_mc_end:
}
@@ -105,8 +90,6 @@
\tag_mc_use:n {#1}
}
-%%%% structure related commands
-
\NewDocumentCommand \tagstructbegin { m }
{
\tag_struct_begin:n {#1}
@@ -122,7 +105,6 @@
\tag_struct_use:n {#1}
}
-%%%% debug/show commands
\NewDocumentCommand\showtagpdfmcdata { O {\__tag_tag_get_mc_abs_cnt:} }
{
\bool_if:NT \g__tag_mode_lua_bool
@@ -158,6 +140,10 @@
}
}
+\NewDocumentCommand\showtagstack {}
+ {
+ \seq_show:N \g__tag_struct_tag_stack_seq
+ }
\sys_if_engine_luatex:T
{
\NewDocumentCommand\pdffakespace { }
@@ -165,6 +151,174 @@
\__tag_fakespace:
}
}
+\bool_new:N \l__tag_para_bool
+\bool_new:N \l__tag_para_show_bool
+\int_new:N \g__tag_para_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}
+ {
+ \int_gincr:N \g__tag_para_int
+ \bool_if:NT \l__tag_para_bool
+ {
+ \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_int\ }
+ \tag_mc_end:
+ }
+ \tag_mc_begin:n {tag=P}
+ }
+ }
+\AddToHook{para/end}
+ {
+ \bool_if:NT \l__tag_para_bool
+ {
+ \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_int}
+ \tag_mc_end:
+ }
+ \tag_struct_end:
+ }
+ }
+
+\newcommand\tagpdfparaOn {\bool_set_true:N \l__tag_para_bool}
+\newcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool}
+
+\cs_generate_variant:Nn \pdfannot_dict_put:nnn {nnx}
+\hook_gput_code:nnn
+ {pdfannot/link/URI/before}
+ {tagpdf}
+ {
+ \bool_if:NT \g__tag_active_struct_bool
+ {
+ \tag_mc_end_push:
+ \tag_struct_begin:n { tag=Link }
+ \tag_mc_begin:n { tag=Link }
+ \pdfannot_dict_put:nnx
+ { link/URI }
+ { StructParent }
+ { \int_use:N\c@g__tag_parenttree_obj_int }
+ }
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/URI/after}
+ {tagpdf}
+ {
+ \bool_if:NT \g__tag_active_struct_bool
+ {
+ \__tag_struct_finish_link:
+ \tag_mc_end:
+ \tag_struct_end:
+ \tag_mc_begin_pop:n{}
+ }
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/GoTo/before}
+ {tagpdf}
+ {
+ \bool_if:NT \g__tag_active_struct_bool
+ {
+ \tag_mc_end_push:
+ \tag_struct_begin:n{tag=Link}
+ \tag_mc_begin:n{tag=Link}
+ \pdfannot_dict_put:nnx
+ { link/GoTo }
+ { StructParent }
+ { \int_use:N\c@g__tag_parenttree_obj_int }
+ }
+ }
+
+\hook_gput_code:nnn
+ {pdfannot/link/GoTo/after}
+ {tagpdf}
+ {
+ \bool_if:NT \g__tag_active_struct_bool
+ {
+ \__tag_struct_finish_link:
+ \tag_mc_end:
+ \tag_struct_end:
+ \tag_mc_begin_pop:n{}
+ }
+ }
+
+\hook_gput_code:nnn
+ {cmd/url/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/url/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+
+\hook_gput_code:nnn
+ {cmd/href/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/href/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+
+\hook_gput_code:nnn
+ {cmd/hrefurl/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/hrefurl/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+
+\hook_gput_code:nnn
+ {cmd/T@ref/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/T@ref/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+
+\hook_gput_code:nnn
+ {cmd/T@pageref/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/T@pageref/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+
+\hook_gput_code:nnn
+ {cmd/T@nameref/before}
+ {tagpdf}
+ {\tag_mc_end_push:}
+
+\hook_gput_code:nnn
+ {cmd/T@nameref/after}
+ {tagpdf}
+ {\tag_mc_begin_pop:n{}}
+\pdfannot_dict_put:nnn
+ { link/URI }
+ { Contents }
+ { (url) }
+
+\pdfannot_dict_put:nnn
+ { link/GoTo }
+ { Contents }
+ { (ref) }
%%
%%
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
index bc9f440b052..f21d27218ba 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.80", --TAGVERSION
- date = "2021-02-23", --TAGDATE
+ version = "0.81", --TAGVERSION
+ date = "2021-05-14", --TAGDATE
description = "tagpdf lua code",
license = "The LATEX Project Public License 1.3c"
}
@@ -98,6 +98,7 @@ local nodeid = node.id
local nodecopy = node.copy
local nodegetattribute = node.get_attribute
local nodesetattribute = node.set_attribute
+local nodehasattribute = node.has_attribute
local nodenew = node.new
local nodetail = node.tail
local nodeslide = node.slide
@@ -217,6 +218,17 @@ local function __tag_mark_spaces (head)
nodesetattribute(kern.next,iwfontattributeid,glyph.font)
end
end
+ -- look also back
+ if glyph.prev and (glyph.prev.id == GLUE)
+ and not inside_math and (glyph.prev.width >0) and not nodehasattribute(glyph.prev,iwspaceattributeid)
+ then
+ nodesetattribute(glyph.prev,iwspaceattributeid,1)
+ nodesetattribute(glyph.prev,iwfontattributeid,glyph.font)
+ -- for debugging
+ if ltx.__tag.trace.showspaces then
+ __tag_show_spacemark (head,glyph)
+ end
+ end
elseif id == PENALTY then
local glyph = n
-- ltx.__tag.trace.log ("PENALTY ".. n.subtype.."VALUE"..n.penalty,3)
@@ -618,7 +630,7 @@ function ltx.__tag.func.fill_parent_tree_line (page)
local structnum = ltx.__tag.mc[mcnum]["parent"]
local propname = "g__tag_struct_"..structnum.."_prop"
local objref = ltx.__tag.tables[propname]["objref"] or "XXXX"
- texio.write_nl("=====>"..tostring(objref))
+ ltx.__tag.trace.log("=====>"..tostring(objref),5)
numsentry = pdfpage .. " [".. objref .. "]"
ltx.__tag.trace.log("PAGETREE PAGE" .. page.. " NUM ENTRY = ".. numsentry,3)
else
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
index 71daeab6935..aa3c436567f 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
@@ -19,7 +19,7 @@
%% and all files in that bundle must be distributed together.
%%
%% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2021/02/23} {0.80}
+\ProvidesExplPackage {tagpdf} {2021/05/14} {0.81}
{ A package to experiment with pdf tagging }
\bool_if:nF
@@ -110,9 +110,9 @@
\ref_attribute_gset:nnnn {tagstructobj} {}{now}
{
\exp_args:Ne
- \pdf_object_if_exist:nT {c__tag_struct_ \int_use:N \c@g__tag_struct_abs_int _obj}
+ \pdf_object_if_exist:nT {__tag/struct/\int_use:N \c@g__tag_struct_abs_int}
{
- \pdf_object_ref:e{c__tag_struct_ \int_use:N \c@g__tag_struct_abs_int _obj}
+ \pdf_object_ref:e{__tag/struct/\int_use:N \c@g__tag_struct_abs_int}
}
}
% replace by abspage??
@@ -176,6 +176,11 @@
\pdfmanagement_remove:nn {Page} {Tabs},
tabsorder .initial:n = structure,
uncompress .code:n = {\pdf_uncompress: },
+ global-mc .code:n =
+ {
+ \cs_set_eq:NN\__tag_attribute_set:Nn \__tag_attribute_gset:Nn
+ \cs_set_eq:NN\__tag_attribute_unset:N\__tag_attribute_gunset:N
+ }
}
\hook_gput_code:nnn{begindocument}{tagpdf}
{
@@ -183,6 +188,10 @@
{
\pdfmanagement_add:nnn { Catalog / MarkInfo } { Marked } { true }
}
+ \keys_define:nn { __tag / setup }
+ {
+ global-mc .code:n={}
+ }
}
diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
index 2032895ec2a..40dc38289f1 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
@@ -1,72 +1,26 @@
-\RequirePackage{expl3}[2018/06/14]
%\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\RequirePackage{xpatch}
-\ProvidesExplPackage {tagpdfdocu-patches} {2019/10/15} {0.70}
+\ProvidesExplPackage {tagpdfdocu-patches} {2021/03/22} {0.80}
{patches/commands for the tagpdf documentation}
-% to do : marginnote, perhaps the description macros ...
-% to do: footnotes!
-% printbibliography?
-
-\newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{tag=BibEntry}}
-\newbibmacro*{finentry}{\finentry\tagmcend\tagstructend}
-
-% hyperref
-\@ifpackageloaded{hyperref}{%
-\pdfstringdefDisableCommands{
- \let\tagstructbegin\@gobble
- \let\tagmcbegin\@gobble
- \let\tagmcend\relax
- \let\tagstructend\relax
-}}{}
-
-%%%%%
-% Paragraphs
-%%%%%
-
-% we need a command which simply starts a paragraph \TagP^,
-% a "continuation" variant which closes the previous paragraph (\TagP),
-% and a final end.
-
-\NewDocumentCommand\TagP{t{^}}
- {
- \tag_mc_if_in:T { \tag_mc_end: }
- \IfBooleanF{#1}
- {
- \tag_struct_end:
- }
- \tag_struct_begin:n{tag=P}
- \tag_mc_begin:n{tag=P}
- }
-% close a mc and one structure
-
-\NewDocumentCommand\TagPend{}
- {
- \tag_mc_if_in:T { \tag_mc_end: }
- \tag_struct_end:
- }
-
-
-%%%%%
-% maketitle
-%%%%%
-\tagpdfsetup{ add-new-tag=Title/H1 }
-
%%%%%
% tableofcontents
%%%%%
+\AfterTOCHead{\tag_struct_begin:n{tag=TOC}}
+\AfterStartingTOC{\tag_struct_end:} %end TOC
%Marking the toc entries
%around the whole entry so only structure:
\newcommand\tagscrtocentry[1]{\tag_struct_begin:n{tag=TOCI}#1\tag_struct_end:}
%leaf so structure and mc:
-\newcommand\tagscrtocpagenumber[1]{%
- \tag_struct_begin:n{tag=Reference}%
- \tag_mc_begin:n{tag=Reference}%
- #1%
- \tag_mc_end:
- \tag_struct_end:}
+\newcommand\tagscrtocpagenumber[1]
+ {
+ \tag_struct_begin:n{tag=Reference}
+ \tag_mc_begin:n{tag=Reference}
+ #1
+ \tag_mc_end:
+ \tag_struct_end:
+ }
\DeclareTOCStyleEntry[
@@ -126,21 +80,21 @@
% Sectioning commands
%%%%%%%%
+\AddtoDoHook{heading/begingroup}{\tagpdfparaOff\use_none:n}
+
\prop_new:N \g_tag_section_level_prop
\prop_gput:Nnn \g_tag_section_level_prop {section}{H1}
\prop_gput:Nnn \g_tag_section_level_prop {subsection}{H2}
\prop_gput:Nnn \g_tag_section_level_prop {subsubsection}{H3}
\prop_gput:Nnn \g_tag_section_level_prop {paragraph}{H4}
-
-
-%unnumbered sections level give an empty mc, need to think about it.
\renewcommand{\sectionlinesformat}[4]
{
\@hangfrom
{\hskip #2
\tagstructbegin{tag=\prop_item:Nn\g_tag_section_level_prop{#1}}
- \tl_if_empty:nF{#3}
+ %\tl_if_empty:nF{#3}
+ \tl_if_in:nnF{\@empty}{#3}
{
\tag_mc_begin:n {tag=\prop_item:Nn\g_tag_section_level_prop{#1}}
#3
@@ -153,48 +107,52 @@
}
%minisec is simply P, H6 doesn't work ....
+% so we let paratagging handle this. But we add a strong structure
+% should changed to H6 as it is no longer required to have H6 only after H5
+%but need to check how to disable paratagging ...
\cs_new:Nn \__tag_docu_tag_minisec:n
{
- \tag_struct_begin:n {tag=P}
- \tag_mc_begin:n{tag=P}
+ \tag_struct_begin:n {tag=Strong}
+ \tag_mc_begin:n{tag=Strong}
#1
\tag_mc_end:
\tag_struct_end:
}
-
+%
\addtokomafont{minisec}{\__tag_docu_tag_minisec:n}
-\AfterTOCHead{\tag_struct_begin:n{tag=TOC}}
-\AfterStartingTOC{\tag_struct_end:} %end TOC
-%% list
+%%%%
+%% Lists
+
+\AddToHook{env/itemize/begin}{\par\tagstructbegin{tag=L}}%\par is needed to close the paragraph before.
+\AddToHook{env/itemize/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
+\AddToHook{env/enumerate/begin}{\par\tagstructbegin{tag=L}}
+\AddToHook{env/enumerate/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
+\AddToHook{env/description/begin}{\par\tagstructbegin{tag=L}}
+\AddToHook{env/description/end}{\par\tagstructend\tagstructend\tagstructend}%LBody,LI,L
\newcommand\tag@enit@format@preset[1]{%
- \tagstructbegin{tag=LI}%
- \tagstructbegin{tag=Lbl}%
- \tagmcbegin{tag=Lbl}%
- #1%
+ \str_if_eq:eeTF { \prop_item:cn { g__tag_struct_\g__tag_struct_stack_current_tl _prop }{S} }{/L}
+ {
+ %\typeout{BEGIN~OF~LIST}
+ }
+ {%\typeout{NEXT ITEM}
+ \tagstructend\tagstructend} % for the LBody/LI
+ \tagstructbegin{tag=LI}
+ \tagstructbegin{tag=Lbl}
+ \tagmcbegin{tag=Lbl}
+ #1
\tagmcend
- \tagstructend %end Lbl
- \tagstructbegin{tag=LBody}}
-
-\newcommand\meti{% end of \item
- \tagstructend %end of LBody
- \tagstructend %end of LI
-}
-
-\newcommand\Pmeti{% end of \item
- \TagPend %end of P
- \tagstructend %end of LBody
- \tagstructend %end of LI
-}
+ \tagstructend
+ \tagstructbegin{tag=LBody}
+ }
\ExplSyntaxOff
\xpatchcmd\enit@preset{\@firstofone}{\tag@enit@format@preset}{}{\fail}
+%close mc from paratagging and reopen ...
+\xpatchcmd\@item{\box\@labels}{\tagmcend \box\@labels \tagmcbegin{tag=P}}{}{\fail}
\ExplSyntaxOn
-\setlist{
- before*=\tagstructbegin{tag=L},
- after*={\tagstructend}}
% keys that overwrite \enit@format must be patched, eg like the follow
% the font key should be patched in a similar way
@@ -205,99 +163,111 @@
\tagmcbegin{tag=Lbl}%
#1\tagmcend}}
- %%% hooks for links
- %%% attention, to get the order right, it is necessary currently to start a new
- %%% mc after a link! I'm not sure if this can/group be included in the hooks
- %%% grouping is a bit tricky ...
-%\cs_if_exist:NT\hook_put_left:nnn
-%{
-% \hook_put_left:nnn
-% { pdf }
-% { annot/Link/URI_begin }
-% {
-% \tag_struct_begin:n{tag=Link}
-% \tag_mc_begin:n{tag=Link}
-% }
-
-\cs_generate_variant:Nn \pdfannot_dict_put:nnn {nnx}
-\hook_gput_code:nnn
- {pdfannot/link/URI/before}
- {tagpdf}
- {
- \tag_struct_begin:n{tag=Link}
- \tag_mc_begin:n{tag=Link}
- \pdfannot_dict_put:nnx
- {link/URI}
- { StructParent }
- { \int_use:N\c@g__tag_parenttree_obj_int }
- }
-%\hook_put_right:nnn
-% { pdf }
-% { annot/Link/URI_end }
-% {
-% \__tag_struct_finish_link:
-% \tag_mc_end:
-% \tag_struct_end:
-% }
-\hook_gput_code:nnn
- {pdfannot/link/URI/after}
- {tagpdf}
- {
- \__tag_struct_finish_link:
- \tag_mc_end:
- \tag_struct_end:
- }
+% listings + verbatim
+% the paragraph code could create span around the lines ...
+% it is quite unclear if Code is a sensible structure as it no longer exists in pdf 2.0
+
+\AddToHook{env/lstlisting/begin}{\tagpdfparaOff\tagstructbegin{tag=Code}\tagmcbegin{tag=Code}}
+\AddToHook{env/lstlisting/end}{\tagmcend\tagstructend}
+
+\AddToHook{env/verbatim/begin}{\tagpdfparaOff\tagstructbegin{tag=Code}\tagmcbegin{tag=Code}}
+\AddToHook{env/verbatim/end}{\tagmcend\tagstructend}
+
+
+% ======== marginnote ==========
+% TODO marginnote has a bug (a \par is missing) so it messes up tagging.
+% but currently unneeded as we marked them up as artifacts anyway as they don't contain
+% meaningful contents
+
+\NewDocumentCommand\sidenote{m}{\begin{tagmcartifact}{notype}\tagpdfparaOff\marginnote{#1}\end{tagmcartifact}}
+
+% ======== tikzpicture ==========
+% TODO this needs some investigation: it messes up the stack if one add paraOff
+
+\AddToHook{env/tikzpicture/begin}{}
+
+%======== tcolorbox ========
+% We switch of paratagging at the begin and reenable it locally in before upper.
+% the before upper setting is dangerous as it can be overwritten by
+% users. So a more stable hook is needed.
+%\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff}
+%\AddToHook{env/docCommand/begin}{\tagpdfparaOff}
+%\tcbset{before~upper=\tagpdfparaOn}
+\AddToHook{env/tcolorbox/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}}
+\AddToHook{env/docCommand/begin}{\tagpdfparaOff \tcbset{before~upper=\tagpdfparaOn}}
+
+ %locally for now
+
+
+% ======= footnote ========
+% TODO
+
+% ======= bibliography ========
+% biblatex. There are some entry mc-chunks somewhere.
+
+\newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{tag=BibEntry}}
+\newbibmacro*{finentry}{\finentry\tagmcend\tagstructend}
+
+% ====== hyperref ========
+% this should probably go into tagpdf, but it is related to
+% problem of pdf strings and context ....
+
+\@ifpackageloaded{hyperref}{%
+\pdfstringdefDisableCommands{
+ \let\tagstructbegin\@gobble
+ \let\tagmcbegin\@gobble
+ \let\tagmcend\relax
+ \let\tagstructend\relax
+}}{}
-%\hook_put_left:nnn
-% { pdf }
-% { annot/Link/GoTo_begin }
-% {
-% \tag_struct_begin:n{tag=Link}
-% \tag_mc_begin:n{tag=Link}
-% }
-
-\hook_gput_code:nnn
- {pdfannot/link/GoTo/before}
- {tagpdf}
+
+%====== pictures ========
+% PAC3 complained that the BBox is missing, so we are cheating for now
+% and add a fix size.
+\tagpdfsetup
{
- \tag_struct_begin:n{tag=Link}
- \tag_mc_begin:n{tag=Link}
- \pdfannot_dict_put:nnx
- {link/GoTo}
- { StructParent }
- { \int_use:N\c@g__tag_parenttree_obj_int }
+ newattribute =
+ {bbox}{/O /Layout /BBox [0~0~100~100]}
}
+%%%%%
+%======== Role maps =========
+%%%%%
+\tagpdfsetup{ add-new-tag=Title/H1,add-new-tag=Strong/Span }
+
+\endinput
-%\hook_put_right:nnn
-% { pdf }
-% { annot/link/GoTo_end }
-% {
-% \__tag_struct_finish_link:
-% \tag_mc_end:
-% \tag_struct_end:
-% }
+% ==========================
+% now unneeded commands
-\hook_gput_code:nnn
- {pdfannot/link/GoTo/after}
- {tagpdf}
+% we need a command which simply starts a paragraph \TagP^,
+% a "continuation" variant which closes the previous paragraph (\TagP),
+% and a final end.
+
+\NewDocumentCommand\TagP{t{^}}
+ {
+ \tag_mc_if_in:T { \tag_mc_end: }
+ \IfBooleanF{#1}
{
- \__tag_struct_finish_link:
- \tag_mc_end:
\tag_struct_end:
}
-% "alternative descriptions " for PAX3. How to get better text here??
-\pdfannot_dict_put:nnx
- {link/URI}
- { Contents }
- { (url) }
+ \tag_struct_begin:n{tag=P}
+ \tag_mc_begin:n{tag=P}
+ }
+% close a mc and one structure
+
+\NewDocumentCommand\TagPend{}
+ {
+ \tag_mc_if_in:T { \tag_mc_end: }
+ \tag_struct_end:
+ }
-\pdfannot_dict_put:nnx
- {link/GoTo}
- { Contents }
- { (ref) }
-\endinput
+ \ExplSyntaxOn
+\newcommand\showcurrentstruct{\prop_show:c { g__tag_struct_\g__tag_struct_stack_current_tl _prop }}
+
+
+\ExplSyntaxOff