diff options
33 files changed, 306 insertions, 148 deletions
diff --git a/Master/texmf-dist/doc/latex/tagpdf/README.md b/Master/texmf-dist/doc/latex/tagpdf/README.md index 334b394fcb2..52a80b7f480 100644 --- a/Master/texmf-dist/doc/latex/tagpdf/README.md +++ b/Master/texmf-dist/doc/latex/tagpdf/README.md @@ -1,6 +1,6 @@ #tagpdf — A package to create tagged pdf -Packageversion: 0.98f -Packagedate: 2023/04/24 +Packageversion: 0.98g +Packagedate: 2023/05/16 Author: Ulrike Fischer ## License diff --git a/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf b/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf Binary files differindex f37e06b89a1..96903459f9e 100644 --- a/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf +++ b/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf diff --git a/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf b/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf Binary files differindex 169a7cbb425..f5f890701e4 100644 --- a/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf +++ b/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf diff --git a/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex b/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex index 89b0c73b0ec..cc3295488e2 100644 --- a/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex +++ b/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex @@ -15,8 +15,8 @@ } \DebugBlocksOff \makeatletter -\def\UlrikeFischer@package@version{0.98f} -\def\UlrikeFischer@package@date{2023-04-24} +\def\UlrikeFischer@package@version{0.98g} +\def\UlrikeFischer@package@date{2023-05-16} \makeatother \documentclass[DIV=12,parskip=half-,bibliography=totoc,a4paper]{article} @@ -558,6 +558,7 @@ command so that \pkg{tagpdf} can pick up the correct code path. { % testphase = phase-I, % tagging without paragraph tagging testphase = phase-II % tagging with paragraph tagging and other new stuff. + % testphase = phase-III % tagging with paragraph sec, toc, block tagging and more % pdfversion = 2.0 % pdfversion must be set here. } \documentclass{article} @@ -566,10 +567,26 @@ some text \end{document} \end{taglstlisting} -\minisec{Activation needed!} +\minisec{Deactivation} -It is not recommended anymore, but -the package can also be loaded normally with |\usepackage| (but it is +When loading \pkg{tagpdf} through the \texttt{testphase} keys, it is automatically activated. +To deactivate it while still retaining all the other new code from the latex-lab testphase files, +use in the preamble |\tagpdfsetup{activate-all=false}|. You can additionally also deactivate the +paratagging and the interword space code. +To suppress the loading of the package alltogether you can try + +\begin{taglstlisting} +\makeatletter +\disable@package@load{tagpdf}{} +\makeatother +\DocumentMetadata{...} +\end{taglstlisting} + + +\minisec{Loading as package needs activation!} + +It is not recommended anymore, but the package can also be loaded normally with |\usepackage| +(but it is still required to use \cs{DocumentMetadata} to load the \PDF\ management) but it will then -- apart from loading more packages and defining a lot of things -- not do much. You will have to \emph{activate} it with \verb+\tagpdfsetup+. @@ -1745,7 +1762,8 @@ These commands insert a structure previously stashed away as kid into the curren -A document should have at least one structure which contains the whole document. A suitable tag is \texttt{Document} or \texttt{Article}. I'm considering to automatically inserting it. +A document should have at least one structure which contains the whole document. A suitable tag is \texttt{Document}. +Such a root is now always added automatically. Its type can be changed with the key \texttt{activate}. 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} diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty index 57fc9d01928..10897d95042 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty @@ -25,7 +25,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\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 } \AddToHook{begindocument} { @@ -69,6 +69,7 @@ \cs_new_protected:Npn \tag_struct_end:{} \cs_new_protected:Npn \tag_struct_end:n{} \cs_new_protected:Npn \tag_struct_use:n #1 {} +\cs_new_protected:Npn \tag_struct_use_num:n #1 {} %% File: tagpdf-checks.dtx \cs_new:Npn \tag_get:n #1 { \use:c {__tag_get_data_#1: } } diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty index ac3026f9df7..d2371856be2 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-debug-generic} {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} \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty index 4a258a39660..a2074ab0984 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty @@ -26,7 +26,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\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} \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {} diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def index ecc291c4db9..ee0f3f70d4f 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} {2023-04-24} {0.98f} +\ProvidesExplFile {tagpdf-luatex.def} {2023-05-16} {0.98g} {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 48ad371d341..ba22688c6a0 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-generic.dtx -\ProvidesExplPackage {tagpdf-mc-code-generic} {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} \__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 f7645eaad5d..bdca8974e0e 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-mc-luacode.dtx -\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-05-16} {0.98g} {tagpdf - mc code only for the luamode } \hook_gput_code:nnn{begindocument}{tagpdf/mc} { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def index 774b4a2c36b..99cbd3923f3 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def index 62db669318a..f4c44e541ea 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-inline.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def index 7906edb242c..dae877831a2 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def index c61dbab28f3..f13846ed821 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-04-24} {0.98f} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-05-16} {0.98g} abs,abs,mathml, and,and,mathml, annotation,annotation,mathml, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def index 5d15b54ad6c..61281c4f7e9 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def index 723d532d561..81edd605927 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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, diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv index 75a37b33127..3e07d2cc21b 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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/tex/latex/tagpdf/tagpdf-parent-child.csv b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv index cebd7efb5b7..cfe51619812 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf-data.dtx -%% \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,∅,∅ diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua index 9caf5ef2d45..b7dc5ca4b6a 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.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/tex/latex/tagpdf/tagpdf.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty index a67db861360..b2e44c1a41f 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty @@ -28,7 +28,7 @@ %% and all files in that bundle must be distributed together. %% %% File: tagpdf.dtx -\ProvidesExplPackage {tagpdf} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdf} {2023-05-16} {0.98g} { A package to experiment with pdf tagging } \bool_if:nF @@ -303,7 +303,7 @@ \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-parent-child} - { Rule~'#1'~-->~'#2'~is~#3} + { Rule~'#1'~-->~'#2'~is~#3~\msg_line_context:} \msg_new:nnn { tag } {role-remapping} { remapping~tag~to~#1 } \msg_new:nnn { tag } {role-tag} { mapping~tag~#1~to~role~#2 } @@ -389,7 +389,7 @@ \prop_get:cnNT {g__tag_struct_\__tag_ref_value:enn{tagpdfstruct-#1}{tagstruct}{unknown}_prop} {P} - \l_tmpa_tl + \l__tag_tmpa_tl { \msg_warning:nnn { tag } {struct-used-twice} {#1} } @@ -856,7 +856,7 @@ } } \tl_new:N \l__tag_parenttree_content_tl - +\cs_new_protected:Npn \__tag_tree_parenttree_rerun_msg: {} \cs_new_protected:Npn \__tag_tree_fill_parenttree: { \int_step_inline:nnnn{1}{1}{\__tag_ref_value_lastpage:nn{abspage}{-1}} %not quite clear if labels are needed. See lua code @@ -896,7 +896,10 @@ } } { - \msg_warning:nn { tag } {tree-mcid-index-wrong} + \cs_set_protected:Npn \__tag_tree_parenttree_rerun_msg: + { + \msg_warning:nn { tag } {tree-mcid-index-wrong} + } } } \tl_put_right:Nn @@ -928,6 +931,7 @@ { \__tag_tree_fill_parenttree: } + \__tag_tree_parenttree_rerun_msg: \tl_put_right:NV \l__tag_parenttree_content_tl\g__tag_parenttree_objr_tl \pdf_object_write:nnx { __tag/tree/parenttree }{dict} { @@ -1800,7 +1804,6 @@ \seq_gpush:Nn \g__tag_struct_stack_seq {0} \seq_new:N \g__tag_struct_tag_stack_seq \seq_gpush:Nn \g__tag_struct_tag_stack_seq {{Root}{StructTreeRoot}} -\prop_new:N\g__tag_struct_tag_NS_prop \tl_new:N \l__tag_struct_stack_parent_tmpa_tl \seq_const_from_clist:Nn \c__tag_struct_StructTreeRoot_entries_seq @@ -1890,11 +1893,13 @@ { parentrole } { {StructTreeRoot}{pdf} } -\prop_gput:Nnn \g__tag_struct_tag_NS_prop {0}{{StructTreeRoot}{pdf}} -\__tag_prop_gput:cnx - { g__tag_struct_0_prop } - { Namespaces } - { \pdf_object_ref:n { __tag/tree/namespaces } } +\pdf_version_compare:NnF < {2.0} + { + \__tag_prop_gput:cnx + { g__tag_struct_0_prop } + { Namespaces } + { \pdf_object_ref:n { __tag/tree/namespaces } } + } \cs_new:Npn \__tag_struct_get_id:n #1 %#1=struct num { ( @@ -1915,7 +1920,6 @@ { g__tag_struct_#1_prop } { S } { \pdf_name_from_unicode_e:n {#2} } % - \prop_gput:Nnn \g__tag_struct_tag_NS_prop {#1}{{#2}{#3}} } } { @@ -1932,7 +1936,6 @@ { NS } { \l__tag_get_tmpc_tl } % } - \prop_gput:Nnn \g__tag_struct_tag_NS_prop {#1}{{#2}{#3}} } } \cs_generate_variant:Nn \__tag_struct_set_tag_info:nnn {eVV} @@ -2646,6 +2649,59 @@ } } } +\cs_set_protected:Npn \tag_struct_use_num:n #1 %#1 is structure number + { + \__tag_check_if_active_struct:T + { + \prop_if_exist:cTF + { g__tag_struct_#1_prop } % + { + \prop_get:cnNT + {g__tag_struct_#1_prop} + {P} + \l__tag_tmpa_tl + { + \msg_warning:nnn { tag } {struct-used-twice} {#1} + } + %add the label structure as kid to the current structure (can be the root) + \__tag_struct_kid_struct_gput_right:xx + { \g__tag_struct_stack_current_tl } + { #1 } + %add the current structure to the labeled one as parents + \__tag_prop_gput:cnx + { g__tag_struct_#1_prop } + { P } + { + \pdf_object_ref:e { __tag/struct/\g__tag_struct_stack_current_tl } + } + \__tag_struct_get_parentrole:eNN + {#1} + \l__tag_tmpa_tl + \l__tag_tmpb_tl + \__tag_check_parent_child:VVVVN + \g__tag_struct_tag_tl + \g__tag_struct_tag_NS_tl + \l__tag_tmpa_tl + \l__tag_tmpb_tl + \l__tag_parent_child_check_tl + \int_compare:nNnT {\l__tag_parent_child_check_tl}<0 + { + \cs_set_eq:NN \l__tag_role_remap_tag_tl \g__tag_struct_tag_tl + \cs_set_eq:NN \l__tag_role_remap_NS_tl \g__tag_struct_tag_NS_tl + \__tag_role_remap: + \cs_gset_eq:NN \g__tag_struct_tag_tl \l__tag_role_remap_tag_tl + \cs_gset_eq:NN \g__tag_struct_tag_NS_tl \l__tag_role_remap_NS_tl + \__tag_struct_set_tag_info:eVV + { \int_eval:n {\c@g__tag_struct_abs_int} } + \g__tag_struct_tag_tl + \g__tag_struct_tag_NS_tl + } + } + { + \msg_warning:nnn{ tag }{struct-label-unknown}{#1} + } + } + } \cs_new:Npn \tag_struct_object_ref:n #1 { \pdf_object_ref:n {__tag/struct/#1} @@ -3004,21 +3060,23 @@ ,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} - } +\tl_new:N\g__tag_root_default_tl +\tl_gset:Nn\g__tag_root_default_tl {Document} + +\hook_gput_code:nnn{begindocument}{tagpdf}{\tagstructbegin{tag=\g__tag_root_default_tl}} +\hook_gput_code:nnn{tagpdf/finish/before}{tagpdf}{\tagstructend} + \keys_define:nn { __tag / setup} { - activate .code:n = + activate .code:n = { \keys_set:nn { __tag / setup } { activate-mc,activate-tree,activate-struct } - \__tag_add_document_structure:n {#1} + \tl_gset:Nn\g__tag_root_default_tl {#1} }, - activate .default:n = Document + activate .default:n = Document } + \AddToHook{begindocument/before} { \bool_lazy_all:nT @@ -3040,6 +3098,7 @@ \__tag_fakespace: } } +\providecommand\pdffakespace{} \bool_new:N \l__tag_para_bool \bool_new:N \l__tag_para_show_bool \int_new:N \g__tag_para_begin_int @@ -3121,24 +3180,28 @@ } \AddToHook{enddocument/info} { - \int_compare:nNnF {\g__tag_para_main_begin_int}={\g__tag_para_main_end_int} + \tag_if_active:F { - \msg_error:nnxxx - {tag} - {para-hook-count-wrong} - {\int_use:N\g__tag_para_main_begin_int} - {\int_use:N\g__tag_para_main_end_int} - {text-unit} + \msg_redirect_name:nnn { tag } { para-hook-count-wrong } { warning } } + \int_compare:nNnF {\g__tag_para_main_begin_int}={\g__tag_para_main_end_int} + { + \msg_error:nnxxx + {tag} + {para-hook-count-wrong} + {\int_use:N\g__tag_para_main_begin_int} + {\int_use:N\g__tag_para_main_end_int} + {text-unit} + } \int_compare:nNnF {\g__tag_para_begin_int}={\g__tag_para_end_int} - { - \msg_error:nnxxx - {tag} - {para-hook-count-wrong} - {\int_use:N\g__tag_para_begin_int} - {\int_use:N\g__tag_para_end_int} - {text} - } + { + \msg_error:nnxxx + {tag} + {para-hook-count-wrong} + {\int_use:N\g__tag_para_begin_int} + {\int_use:N\g__tag_para_end_int} + {text} + } } \AddToHook{begindocument/before} { diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty index 35900172678..527d7bec01f 100644 --- a/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty +++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty @@ -1,5 +1,5 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2023-04-24} {0.98f} +\ProvidesExplPackage {tagpdfdocu-patches} {2023-05-16} {0.98g} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} |