diff options
author | Karl Berry <karl@freefriends.org> | 2023-05-16 20:22:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-05-16 20:22:46 +0000 |
commit | a872eeeb9a77a7ec51f19b1923d2f5909db1034c (patch) | |
tree | 7efb29c4b808d296ef3618688d79dd1eb2015ba1 /Master/texmf-dist/source/latex/tagpdf | |
parent | 9878b019471468462f25f79fd6a5837b9bcad076 (diff) |
tagpdf (16may23)
git-svn-id: svn://tug.org/texlive/trunk@67136 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tagpdf')
12 files changed, 163 insertions, 87 deletions
diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx index 76019355288..2f0e0fa8b9a 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*luatex> -\ProvidesExplFile {tagpdf-luatex.def} {2023-04-24} {0.98f} +\ProvidesExplFile {tagpdf-luatex.def} {2023-05-16} {0.98g} {tagpdf~driver~for~luatex} % \end{macrocode} % \section{Loading the lua} @@ -158,8 +158,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.98f", --TAGVERSION - date = "2023-04-24", --TAGDATE + version = "0.98g", --TAGVERSION + date = "2023-05-16", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx index acabf29f971..830e667b527 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx @@ -48,7 +48,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \section{Commands} @@ -295,7 +295,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-checks-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-checks-code} {2023-05-16} {0.98g} {part of tagpdf - code related to checks, conditionals, debugging and messages} %</header> % \end{macrocode} @@ -441,7 +441,7 @@ % parent tags. % \begin{macrocode} \msg_new:nnn { tag } {role-parent-child} - { Rule~'#1'~-->~'#2'~is~#3} + { Rule~'#1'~-->~'#2'~is~#3~\msg_line_context:} % \end{macrocode} % \end{macro} % \begin{macro}{role-parent-child} @@ -633,7 +633,7 @@ \prop_get:cnNT {g_@@_struct_\@@_ref_value:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop} {P} - \l_tmpa_tl + \l_@@_tmpa_tl { \msg_warning:nnn { tag } {struct-used-twice} {#1} } diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx index fbdf89360ec..b2955c8a941 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % This files contains a various data files which are read in @@ -60,7 +60,7 @@ % It lists the new tag, the rolemap and the namespace of the rolemap. % \begin{macrocode} %<*ns-latex> -%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-05-16} {0.98g} %% {latex} {https://www.latex-project.org/ns/dflt/2022}{} title, Title, pdf2, part, Title, pdf2, @@ -92,7 +92,7 @@ text, P, pdf2, % It is bound to change % \begin{macrocode} %<*ns-latex-book> -%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-05-16} {0.98g} %% {latex-book} {https://www.latex-project.org/ns/book/2022}{} chapter, H1,pdf2, section, H2,pdf2, @@ -108,7 +108,7 @@ subparagraph, H6,pdf2, % It is bound to change a lot! % \begin{macrocode} %<*ns-latex-inline> -%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-05-16} {0.98g} %% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{} chapter, Span, pdf2, section, Span, pdf2, @@ -122,7 +122,7 @@ P, Span, pdf2, % \section{The pdf namespace data} % \begin{macrocode} %<*ns-pdf> -%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-05-16} {0.98g} %% {pdf} {http://iso.org/pdf/ssn}{} StructTreeRoot,StructTreeRoot,pdf,D, Document,Document,pdf,D, @@ -190,7 +190,7 @@ Strong,Span,pdf,I, % \section{The pdf 2.0 namespace data} % \begin{macrocode} %<*ns-pdf2> -%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-05-16} {0.98g} %% {pdf2} {http://iso.org/pdf2/ssn}{} Document,Document,pdf2,D, Part,Part,pdf2,G, @@ -246,7 +246,7 @@ Strong,Strong,pdf2,I, % \section{The mathml namespace data} % \begin{macrocode} %<*ns-mathml> -%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-05-16} {0.98g} % {mathml}{http://www.w3.org/1998/Math/MathML}{} abs,abs,mathml, and,and,mathml, @@ -481,7 +481,7 @@ xor,xor,mathml, % This will perhaps change in future. % \begin{macrocode} %<*parent-child> -%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-05-16} {0.98g} ,,,StructTreeRoot,Document,Art,Part,Div,Sect,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,MC Document,both,document level,1,0..n,∅,‡,‡,∅,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅ Art,1.7,grouping,∅,0..n,∅,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,0..1,0..1,∅,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,∅,∅ @@ -536,7 +536,7 @@ MC,both,---,∅,∅,∅,∅,∅,∅,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0.. % This will perhaps change in future. % \begin{macrocode} %<*parent-child-2> -%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-05-16} {0.98g} ,,,StructTreeRoot,Document,DocumentFragment,Art,Part,Div,Sect,Aside,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Title,Sub,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Em,Strong,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,FENote,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,math,mathml,Artifact,MC Document,both,document level,1,0..n,0..n,∅,‡,‡,∅,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅ DocumentFragment,2.0,document level,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,0..n,∅ diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx index a7b129f2d33..68479088a5c 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \end{documentation} @@ -55,11 +55,11 @@ % \begin{macrocode} %<@@=tag> %<*generic> -\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-05-16} {0.98g} {part of tagpdf - code related to marking chunks - generic mode} %</generic> %<*debug> -\ProvidesExplPackage {tagpdf-debug-generic} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-debug-generic} {2023-05-16} {0.98g} {part of tagpdf - debugging code related to marking chunks - generic mode} %</debug> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx index 08460ad418a..a4f61192df2 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{implementation} % The code is splitted into three parts: code shared by all engines, @@ -86,7 +86,7 @@ % \begin{macrocode} %<@@=tag> %<*luamode> -\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-05-16} {0.98g} {tagpdf - mc code only for the luamode } %</luamode> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx index fb2dcb19961..cdc0aaa5a3c 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -174,7 +174,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-05-16} {0.98g} {part of tagpdf - code related to marking chunks - code shared by generic and luamode } %</header> diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx index 89216c5f881..ce860d71fa0 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \begin{function} @@ -98,7 +98,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-roles-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-roles-code} {2023-05-16} {0.98g} {part of tagpdf - code related to roles and structure names} %</header> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx index 946887b06b6..e8c1edfd5c3 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \begin{function}{interwordspace (setup-key)} @@ -64,7 +64,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-space-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-space-code} {2023-05-16} {0.98g} {part of tagpdf - code related to real space chars} %</header> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx index 6d4d14fb89f..81211bd445f 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -247,7 +247,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-struct-code} {2023-05-16} {0.98g} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -303,13 +303,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_@@_struct_tag_NS_prop} -% For the parent-child check, we need the tag and NS of every structure -% \begin{macrocode} -\prop_new:N\g_@@_struct_tag_NS_prop -% \end{macrocode} -% \end{variable} -% % % \begin{variable}{\g_@@_struct_stack_current_tl,\l_@@_struct_stack_parent_tmpa_tl} % The global variable will hold the current structure number. It is already @@ -516,16 +509,17 @@ { parentrole } { {StructTreeRoot}{pdf} } -\prop_gput:Nnn \g_@@_struct_tag_NS_prop {0}{{StructTreeRoot}{pdf}} % \end{macrocode} -% Namespaces are pdf 2.0 but it doesn't harm -% to have an empty entry. We could add a test, but if the code moves into -% the kernel, timing could get tricky. +% Namespaces are pdf 2.0. +% If the code moves into the kernel, the setting must be probably delayed. % \begin{macrocode} -\@@_prop_gput:cnx - { g_@@_struct_0_prop } - { Namespaces } - { \pdf_object_ref:n { @@/tree/namespaces } } +\pdf_version_compare:NnF < {2.0} + { + \@@_prop_gput:cnx + { g_@@_struct_0_prop } + { Namespaces } + { \pdf_object_ref:n { @@/tree/namespaces } } + } % \end{macrocode} % \end{variable} % @@ -562,7 +556,6 @@ { g_@@_struct_#1_prop } { S } { \pdf_name_from_unicode_e:n {#2} } % - \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}} } } { @@ -579,7 +572,6 @@ { NS } { \l_@@_get_tmpc_tl } % } - \prop_gput:Nnn \g_@@_struct_tag_NS_prop {#1}{{#2}{#3}} } } \cs_generate_variant:Nn \@@_struct_set_tag_info:nnn {eVV} @@ -1553,7 +1545,75 @@ %</package> % \end{macrocode} % \end{macro} -% +% \begin{macro}{\tag_struct_use_num:n} +% This command allows to use a stashed structure in another place. +% differently to the previous command it doesn't use a label but directly +% a structure number to find the parent. +% TODO: decide how it should be guarded. Probably by the struct-check. +% \begin{macrocode} +%<base>\cs_new_protected:Npn \tag_struct_use_num:n #1 {} +%<*package> +\cs_set_protected:Npn \tag_struct_use_num:n #1 %#1 is structure number + { + \@@_check_if_active_struct:T + { + \prop_if_exist:cTF + { g_@@_struct_#1_prop } % + { + \prop_get:cnNT + {g_@@_struct_#1_prop} + {P} + \l_@@_tmpa_tl + { + \msg_warning:nnn { tag } {struct-used-twice} {#1} + } + %add the label structure as kid to the current structure (can be the root) + \@@_struct_kid_struct_gput_right:xx + { \g_@@_struct_stack_current_tl } + { #1 } + %add the current structure to the labeled one as parents + \@@_prop_gput:cnx + { g_@@_struct_#1_prop } + { P } + { + \pdf_object_ref:e { @@/struct/\g_@@_struct_stack_current_tl } + } +% \end{macrocode} +% check if the tag is allowed as child. Here we have to retrieve the +% tag info for the child, while the data for the parent is in +% the global tl-vars: +% \begin{macrocode} + \@@_struct_get_parentrole:eNN + {#1} + \l_@@_tmpa_tl + \l_@@_tmpb_tl + \@@_check_parent_child:VVVVN + \g_@@_struct_tag_tl + \g_@@_struct_tag_NS_tl + \l_@@_tmpa_tl + \l_@@_tmpb_tl + \l_@@_parent_child_check_tl + \int_compare:nNnT {\l_@@_parent_child_check_tl}<0 + { + \cs_set_eq:NN \l_@@_role_remap_tag_tl \g_@@_struct_tag_tl + \cs_set_eq:NN \l_@@_role_remap_NS_tl \g_@@_struct_tag_NS_tl + \@@_role_remap: + \cs_gset_eq:NN \g_@@_struct_tag_tl \l_@@_role_remap_tag_tl + \cs_gset_eq:NN \g_@@_struct_tag_NS_tl \l_@@_role_remap_NS_tl + \@@_struct_set_tag_info:eVV + { \int_eval:n {\c@g_@@_struct_abs_int} } + \g_@@_struct_tag_tl + \g_@@_struct_tag_NS_tl + } + } + { + \msg_warning:nnn{ tag }{struct-label-unknown}{#1} + } + } + } +%</package> +% \end{macrocode} +% \end{macro} % \begin{macro}[EXP]{\tag_struct_object_ref:n} % This is a command that allows to reference a structure. The argument is the % number which can be get for the current structure with |\tag_get:n{struct_num}| @@ -1643,7 +1703,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-attr-code} {2023-05-16} {0.98g} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx index 4692689ff31..decc64928fc 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-tree-code} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-tree-code} {2023-05-16} {0.98g} {part of tagpdf - code related to writing trees and dictionaries to the pdf} %</header> % \end{macrocode} @@ -310,7 +310,7 @@ % This is the main command to assemble the page related entries of the parent tree. % It wanders through the pages and the mcid numbers and collects all mcid of one page. % \begin{macrocode} - +\cs_new_protected:Npn \@@_tree_parenttree_rerun_msg: {} \cs_new_protected:Npn \@@_tree_fill_parenttree: { \int_step_inline:nnnn{1}{1}{\@@_ref_value_lastpage:nn{abspage}{-1}} %not quite clear if labels are needed. See lua code @@ -350,7 +350,10 @@ } } { - \msg_warning:nn { tag } {tree-mcid-index-wrong} + \cs_set_protected:Npn \@@_tree_parenttree_rerun_msg: + { + \msg_warning:nn { tag } {tree-mcid-index-wrong} + } } } \tl_put_right:Nn @@ -396,6 +399,7 @@ { \@@_tree_fill_parenttree: } + \@@_tree_parenttree_rerun_msg: \tl_put_right:NV \l_@@_parenttree_content_tl\g_@@_parenttree_objr_tl \pdf_object_write:nnx { @@/tree/parenttree }{dict} { diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx index 9df99ecda23..36da045bbad 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98f, released 2023-04-24} +% \date{Version 0.98g, released 2023-05-16} % \maketitle % \begin{documentation} % \section{Setup commands} @@ -250,7 +250,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-user} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-user} {2023-05-16} {0.98g} {tagpdf - user commands} %</header> % \end{macrocode} @@ -513,28 +513,30 @@ % % \section{Commands to extend document commands} % The following commands and code parts are not core command of tagpdf. -% The either provide work arounds for missing functionality elsewhere, +% They either provide work-arounds for missing functionality elsewhere, % or do a first step to apply tagpdf commands to document commands. % This part should be regularly revisited to check if the code should go to a % better place or can be improved. % \subsection{Document structure} -% \begin{macro}{\@@_add_document_structure:n,activate (setup-key)} +% \begin{macro}{\g_@@_root_default_tl,activate (setup-key)} % \begin{macrocode} -\cs_new_protected:Npn \@@_add_document_structure:n #1 - { - \hook_gput_code:nnn{begindocument}{tagpdf}{\tagstructbegin{tag=#1}} - \hook_gput_code:nnn{tagpdf/finish/before}{tagpdf}{\tagstructend} - } +\tl_new:N\g_@@_root_default_tl +\tl_gset:Nn\g_@@_root_default_tl {Document} + +\hook_gput_code:nnn{begindocument}{tagpdf}{\tagstructbegin{tag=\g_@@_root_default_tl}} +\hook_gput_code:nnn{tagpdf/finish/before}{tagpdf}{\tagstructend} + \keys_define:nn { @@ / setup} - { - activate .code:n = + { + activate .code:n = { \keys_set:nn { @@ / setup } { activate-mc,activate-tree,activate-struct } - \@@_add_document_structure:n {#1} + \tl_gset:Nn\g_@@_root_default_tl {#1} }, - activate .default:n = Document + activate .default:n = Document } + % \end{macrocode} % \end{macro} % \subsection{Structure destinations} @@ -563,7 +565,7 @@ % \subsection{Fake space} % \begin{macro}{\pdffakespace} % We need a luatex variant for |\pdffakespace|. This should probably go into -% the kernel at some time. +% the kernel at some time. We also provide a no-op version for dvi mode % \begin{macrocode} \sys_if_engine_luatex:T { @@ -572,6 +574,7 @@ \@@_fakespace: } } +\providecommand\pdffakespace{} % \end{macrocode} % \end{macro} % @@ -697,26 +700,35 @@ } } } +% \end{macrocode} +% We check the para count at the end. If tagging is not active it is not a error, +% but we issue a warning as it perhaps indicates that the testphase code didn't guard +% everything correctly. +% \begin{macrocode} \AddToHook{enddocument/info} { - \int_compare:nNnF {\g_@@_para_main_begin_int}={\g_@@_para_main_end_int} + \tag_if_active:F { - \msg_error:nnxxx - {tag} - {para-hook-count-wrong} - {\int_use:N\g_@@_para_main_begin_int} - {\int_use:N\g_@@_para_main_end_int} - {text-unit} - } + \msg_redirect_name:nnn { tag } { para-hook-count-wrong } { warning } + } + \int_compare:nNnF {\g_@@_para_main_begin_int}={\g_@@_para_main_end_int} + { + \msg_error:nnxxx + {tag} + {para-hook-count-wrong} + {\int_use:N\g_@@_para_main_begin_int} + {\int_use:N\g_@@_para_main_end_int} + {text-unit} + } \int_compare:nNnF {\g_@@_para_begin_int}={\g_@@_para_end_int} - { - \msg_error:nnxxx - {tag} - {para-hook-count-wrong} - {\int_use:N\g_@@_para_begin_int} - {\int_use:N\g_@@_para_end_int} - {text} - } + { + \msg_error:nnxxx + {tag} + {para-hook-count-wrong} + {\int_use:N\g_@@_para_begin_int} + {\int_use:N\g_@@_para_end_int} + {text} + } } % \end{macrocode} % In generic mode we need the additional code from the ptagging tests. diff --git a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx index 0ce62a89844..e9a394b5d49 100644 --- a/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx +++ b/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx @@ -36,7 +36,7 @@ % \begin{function}{ \tag_stop_group_begin:, \tag_stop_group_end:, % \tag_stop:, \tag_start: } % We need commands to stop tagging in some places. -% There simply switches the two local booleans. The grouping commands +% They simply switches the two local booleans. The grouping commands % can be used to group the effect. % \end{function} % @@ -92,7 +92,7 @@ % \begin{macrocode} %<@@=tag> %<*package> -\ProvidesExplPackage {tagpdf} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf} {2023-05-16} {0.98g} { A package to experiment with pdf tagging } \bool_if:nF @@ -118,7 +118,7 @@ % \end{macrocode} %<*debug> % \begin{macrocode} -\ProvidesExplPackage {tagpdf-debug} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-debug} {2023-05-16} {0.98g} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} % \end{macrocode} @@ -141,7 +141,7 @@ % we define a base package with dummy functions % \begin{macrocode} %<*base> -\ProvidesExplPackage {tagpdf-base} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-base} {2023-05-16} {0.98g} {part of tagpdf - provide base, no-op versions of the user commands } %</base> % \end{macrocode} |