texlive[70779] Master/texmf-dist: tagpdf (26mar24)

commits+karl at tug.org commits+karl at tug.org
Tue Mar 26 21:16:04 CET 2024


Revision: 70779
          https://tug.org/svn/texlive?view=revision&revision=70779
Author:   karl
Date:     2024-03-26 21:16:04 +0100 (Tue, 26 Mar 2024)
Log Message:
-----------
tagpdf (26mar24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-AF-file.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-alt-actualtext.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-attribute.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-formula-problem.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-list.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-mc-manual-para-split-obsolete.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-softhyphen.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-spaceglyph-listings.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-structure-obsolete.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/ex-tagpdf-template.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex
    trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdfsetup-keys.tex
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
    trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
    trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/README.md	2024-03-26 20:16:04 UTC (rev 70779)
@@ -1,6 +1,6 @@
 #tagpdf — A package to create tagged pdf
-Packageversion: 0.98x 
-Packagedate: 2024/02/29
+Packageversion: 0.99a 
+Packagedate: 2024/03/27
 Author: Ulrike Fischer, LaTeX Project Team
 
 ## License

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-AF-file.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-alt-actualtext.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-attribute.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-formula-problem.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-list.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-mc-manual-para-split-obsolete.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-softhyphen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-spaceglyph-listings.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-structure-obsolete.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/ex-tagpdf-template.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdf.tex	2024-03-26 20:16:04 UTC (rev 70779)
@@ -16,8 +16,8 @@
  }
 \DebugBlocksOff
 \makeatletter
-\def\UlrikeFischer at package@version{0.98x}
-\def\UlrikeFischer at package@date{2024-02-29}
+\def\UlrikeFischer at package@version{0.99a}
+\def\UlrikeFischer at package@date{2024-03-27}
 \makeatother
 
 \documentclass[bibliography=totoc,a4paper]{article}
@@ -34,8 +34,8 @@
 \usepackage[style=numeric]{biblatex}
 \addbibresource{tagpdf.bib}
 
-\usepackage[noparboxrestore]{marginnote}
 \reversemarginpar
+\NewDocumentCommand\sidenote{m}{\marginpar{#1}}
 \usepackage{booktabs}
 \setlength\belowcaptionskip{10pt}
 \usepackage{tcolorbox}
@@ -384,10 +384,11 @@
 \begin{taglstlisting}
 \DocumentMetadata
  {
-  % 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.
+  % testphase = phase-I,  % tagging without paragraph tagging
+  % testphase = phase-II, % tagging with paragraph tagging 
+   testphase = phase-III, % tagging with paragraph sec, toc, blocks and more
+   pdfversion = 2.0,   % pdfversion must be set here.
+   pdfstandard=ua-2,   % pdfstandard can be set too 
  }
 \documentclass{article}
 \begin{document}
@@ -1028,7 +1029,7 @@
   The validators complain if some text is not marked up, but it is not 
   quite clear if this is a serious problem. 
 
-  The\sidenote{lua mode only} lua mode will mark up everything unmarked as 
+  The\sidenote{lua mode} lua mode will mark up everything unmarked as 
   \texttt{artifact=notype}. You can suppress this behavior by setting the 
   tagpdfsetup key \texttt{activate/tagunmarked} to false. See section 
   \ref{ssec:setup}. 
@@ -1199,7 +1200,7 @@
 
 \subsubsection{Luamode: global or not global -- that is the question}\label{sec:global-local}
 
-In\sidenote{Luamode mode only} luamode the mc-commands set and unset an 
+In\sidenote{lua mode} luamode the mc-commands set and unset an 
 attribute to mark the nodes. One can view such an attribute like a font 
 change or a color: they affect all following chars and glue nodes until 
 stopped. 
@@ -1858,7 +1859,8 @@
 
    \item[\PrintKeyName{lang}] This key allows to set the language for
      a structure element. The value should be a bcp-identifier,
-     e.g. |de-De|.
+     e.g. |de-De|. It can also be set \enquote{from the outside} for all
+     structures in the current group with \cs{tagpdfsetup} and the |text/lang| key.
 
    \item[\PrintKeyName{ref}] This key allows to add references to
      other structure elements, it adds the |/Ref| array to the
@@ -2472,8 +2474,6 @@
 
 \section{Storing and reusing boxes}\label{sec:savebox}
 
-\section{Saving and using boxes}
-
 \TeX{} allows to store material in boxes and to use these box once or 
 multiple times in other places. This poses some challenges to tagging. The 
 listings in the following examples uses low-level \TeX{} box commands to 
@@ -2523,7 +2523,7 @@
 
 We assume in the following that the box contains only well balanced tagging 
 commands and no parts that are \enquote{untagged}. It should be possible to 
-copy the whole box inside a \verb+\tagstructbegin+/\verb+\tagstructend+ 
+copy the whole box inside a \verb+\tagstructbegin+/\hspace{0pt}\verb+\tagstructend+ 
 pair. So the following is fine as box content 
 \begin{taglstlisting}
 box=\tagstructbegin{...}\tagmcbegin{} balanced content\tagmcend\tagstructend

Modified: trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdfsetup-keys.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdfsetup-keys.tex	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/doc/latex/tagpdf/tagpdfsetup-keys.tex	2024-03-26 20:16:04 UTC (rev 70779)
@@ -66,6 +66,8 @@
 %% table key path
 % true/false/layout
 table/tagging     & table-tagging  &choice           &code  &latex-lab-table\\
-table/header-rows & table-header-rows& clist         &clist &latex-lab-table\\
+table/header-rows & table-header-rows& clist         &clist &latex-lab-table\\[4pt]\midrule
+% change for text
+text/lang         & ---             & string         & code &tagpdf-user  \\
 \bottomrule
 \end{tabular}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-backend.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*luatex>
-\ProvidesExplFile {tagpdf-luatex.def} {2024-02-29} {0.98x}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-03-27} {0.99a}
   {tagpdf~driver~for~luatex}
 %    \end{macrocode}
 % \section{Loading the lua}
@@ -164,8 +164,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.98x",       --TAGVERSION
-    date          = "2024-02-29", --TAGDATE
+    version       = "0.99a",       --TAGVERSION
+    date          = "2024-03-27", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -704,7 +704,7 @@
 % TODO: is uses internal l3pdf commands, this should be properly supported by l3pdf
 %    \begin{macrocode}
 local function @@_pdf_object_ref (name)
-   local tokenname = 'c__pdf_backend_object_'..name..'_int'
+   local tokenname = 'c__pdf_object_'..name..'_int'
    local object = token.create(tokenname).mode ..' 0 R'
    return object
 end

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-checks.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -48,7 +48,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \section{Commands}
@@ -295,7 +295,11 @@
 % if there are (beside Root) other open structures on the stack.
 % \end{function}
 % 
-
+% \begin{function}{tree-statistic}
+% Message issued at the end of the compilation 
+% showing the number of objects to write
+% \end{function}
+%
 % \begin{function}{show-struct,show-kids}
 % These two messages are used in debug mode
 % to show the current structures in the log and terminal.
@@ -327,7 +331,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-checks-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-checks-code} {2024-03-27} {0.99a}
  {part of tagpdf - code related to checks, conditionals, debugging and messages}
 %</header>
 %    \end{macrocode}
@@ -461,6 +465,22 @@
     The~structures~are~automatically~closed,\\
     but~their~nesting~can~be~wrong.  
   }
+%    \end{macrocode}
+% \end{macro} 
+% 
+% \begin{macro}{tree-statistic}
+% Message issued at the end showing the estimated number of 
+% structures and MC-childs
+%    \begin{macrocode}
+\msg_new:nnn { tag } {tree-statistic}
+  { 
+    Finalizing~the~tagging~structure:\\
+    Writing~out~\c_tilde_str
+    \int_use:N\c at g_@@_struct_abs_int\c_space_tl~structure~objects\\
+    with~\c_tilde_str
+    \int_use:N\c at g_@@_MCID_abs_int\c_space_tl'MC'~leaf~nodes.\\
+    Be~patient~if~there~are~lots~of~objects!
+  }
 %</package>  
 %    \end{macrocode}
 % \end{macro} 
@@ -1128,5 +1148,25 @@
 %    \begin{macrocode}
 %</debug>
 %    \end{macrocode}
+%
+% \subsection{Benchmarks}
+% It doesn't make much sense to do benchmarks in debug mode or in combination
+% with a log-level as this would slow down the compilation.
+% So we add simple commands that can be activated if l3benchmark has been loaded.
+% TODO: is a warning needed?
+%    \begin{macrocode}
+%<*package>
+\cs_new_protected:Npn \@@_check_benchmark_tic:{}
+\cs_new_protected:Npn \@@_check_benchmark_toc:{}
+\cs_new_protected:Npn \tag_check_benchmark_on:
+  {
+    \cs_if_exist:NT \benchmark_tic:
+     {
+       \cs_set_eq:NN \@@_check_benchmark_tic: \benchmark_tic:
+       \cs_set_eq:NN \@@_check_benchmark_toc: \benchmark_toc:
+     }  
+  }
+%</package>  
+%    \end{macrocode}
 % \end{implementation}
 % \PrintIndex

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-data.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -47,7 +47,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % This files contains a various data files which are read in
@@ -61,7 +61,7 @@
 % latex-lab has also a namespace module, which takes precendence!
 %    \begin{macrocode}
 %<*ns-latex>
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-03-27} {0.99a}
 %% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
 title,        Title,    pdf2,
 part,         Title,    pdf2,
@@ -93,7 +93,7 @@
 % It is bound to change
 %    \begin{macrocode}
 %<*ns-latex-book>
-%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-03-27} {0.99a}
 %% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
 chapter,       H1,pdf2,
 section,       H2,pdf2,
@@ -107,7 +107,7 @@
 % \section{The pdf namespace data}
 %    \begin{macrocode}
 %<*ns-pdf>
-%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-03-27} {0.99a}
 %%  {pdf}   {http://iso.org/pdf/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf,D,
 Document,Document,pdf,D,   
@@ -175,7 +175,7 @@
 % \section{The pdf 2.0 namespace data}
 %    \begin{macrocode}
 %<*ns-pdf2>
-%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-02-29} {0.98x} 
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-03-27} {0.99a} 
 %%  {pdf2}  {http://iso.org/pdf2/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf2,D,
 Document,Document,pdf2,D,   
@@ -232,7 +232,7 @@
 % \section{The mathml namespace data}
 %    \begin{macrocode}
 %<*ns-mathml>
-%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-03-27} {0.99a}
 % {mathml}{http://www.w3.org/1998/Math/MathML}{}
 abs,abs,mathml,
 and,and,mathml,
@@ -467,7 +467,7 @@
 % This will perhaps change in future.
 %    \begin{macrocode}
 %<*parent-child>
-%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-03-27} {0.99a}
 ,,,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,∅,∅
@@ -522,7 +522,7 @@
 % This will perhaps change in future.
 %    \begin{macrocode}
 %<*parent-child-2>
-%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-03-27} {0.99a}
 ,,,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,∅

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-generic.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \end{documentation}
@@ -55,11 +55,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*generic>
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-03-27} {0.99a}
  {part of tagpdf - code related to marking chunks - generic mode}
 %</generic>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-03-27} {0.99a}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 %</debug>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-luacode.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{implementation}
 % The code is splitted into three parts: code shared by all engines,
@@ -86,11 +86,11 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*luamode>
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-03-27} {0.99a}
   {tagpdf - mc code only for the luamode }
 %</luamode>
 %<*debug>
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-03-27} {0.99a}
  {part of tagpdf - debugging code related to marking chunks - lua mode}
 %</debug>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-mc-shared.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -181,7 +181,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-mc-code-shared} {2024-03-27} {0.99a}
   {part of tagpdf - code related to marking chunks -
    code shared by generic and luamode }
 %</header>
@@ -191,8 +191,8 @@
 % MC chunks must be counted.
 % I use a latex counter for the absolute count, so that it is added to
 % |\cl@@ckpt| and restored e.g. in tabulars and align.
-% |\int_new:N  \c at g_@@_MCID_int| and
-% |\tl_put_right:Nn\cl@@ckpt{\@elt{g_uf_test_int}}|
+% |\int_new:N  \c at g_@@_MCID_abs_int| and
+% |\tl_put_right:Nn\cl@@ckpt{\@elt{g_@@_MCID_abs_int}}|
 % would work too, but as the name is not expl3 then too, why bother?
 % The absolute counter can be used to label and to check if the page
 % counter needs a reset.

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-roles.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \begin{function}
@@ -98,7 +98,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-roles-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-roles-code} {2024-03-27} {0.99a}
  {part of tagpdf - code related to roles and structure names}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-space.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \begin{function}{activate/space (setup-key),interwordspace (deprecated)}
@@ -66,7 +66,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-space-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-space-code} {2024-03-27} {0.99a}
  {part of tagpdf - code related to real space chars}
 %</header>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-struct.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \section{Public Commands}
@@ -285,7 +285,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-struct-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-struct-code} {2024-03-27} {0.99a}
  {part of tagpdf - code related to storing structure}
 %</header>
 %    \end{macrocode}
@@ -791,14 +791,14 @@
 %  break into two or more mcid. In this case the lua code has to convert
 %  put the dictionary of the kid into an array. See issue 13 at tagpdf repo.
 %  We exchange the dummy command for the kids to mark this case.
+%  Change 2024-03-19: don't use a regex - that is slow.
 %    \begin{macrocode}
 \cs_new_protected:Npn\@@_struct_exchange_kid_command:N #1 %#1 = seq var
   {
     \seq_gpop_left:NN #1 \l_@@_tmpa_tl
-    \regex_replace_once:nnN
-      { \c{\@@_mc_insert_mcid_kids:n} }
-      { \c{\@@_mc_insert_mcid_single_kids:n} }
-      \l_@@_tmpa_tl
+    \tl_replace_once:Nnn \l_@@_tmpa_tl
+     {\@@_mc_insert_mcid_kids:n}
+     {\@@_mc_insert_mcid_single_kids:n}    
     \seq_gput_left:NV #1 \l_@@_tmpa_tl
   }
 
@@ -900,49 +900,41 @@
 % \begin{macro}{\@@_struct_get_dict_content:nN}
 % This maps the dictionary content of a structure into a tl-var.
 % Basically it does what |\pdfdict_use:n| does.
-% TODO!! this looks over-complicated. Check if it can be done with pdfdict now.
+% This is used a lot so should be rather fast.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_struct_get_dict_content:nN #1 #2 %#1: stucture num
   {
     \tl_clear:N #2
-    \seq_map_inline:cn
+    \prop_map_inline:cn { g_@@_struct_#1_prop }
       {
-        c_@@_struct_
-         \int_compare:nNnTF{#1}={0}{StructTreeRoot}{StructElem}
-         _entries_seq
-      }
-      {
-        \tl_put_right:Ne
-          #2
+        \tl_put_right:Ne #2 
           {
-             \prop_if_in:cnT
-               { g_@@_struct_#1_prop }
-               { ##1 }
-               {
-                 \c_space_tl/##1~
 %    \end{macrocode}
-% Some keys needs the option to format the key, e.g. add brackets for an
-% array
-%    \begin{macrocode}
-                 \cs_if_exist_use:cTF {@@_struct_format_##1:e}
-                   {
-                     { \prop_item:cn{ g_@@_struct_#1_prop } { ##1 } }
-                   }
-                   {
-                     \prop_item:cn{ g_@@_struct_#1_prop } { ##1 }
-                   }
-               }
+% Some keys needs the option to format the value, e.g. add brackets for an
+% array, we also need the option to ignore some entries in the properties.
+%    \begin{macrocode}        
+           \cs_if_exist_use:cTF {@@_struct_format_##1:nn}
+             {{##1}{##2}}
+             {\c_space_tl/##1~##2}
           }
       }
   }
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\@@_struct_format_Ref:n}
+% 
+% \begin{macro}{\@@_struct_format_rolemap:nn,\@@_struct_format_parentrole:nn}
+% This two entries should not end in the PDF.
+%    \begin{macrocode}
+\cs_new:Nn\@@_struct_format_rolemap:nn{}
+\cs_new:Nn\@@_struct_format_parentrole:nn{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\@@_struct_format_Ref:nn}
 % Ref is an array, we store only the content to be able to extend it
 % so the formatting command adds the brackets:
 %    \begin{macrocode}
-\cs_new:Nn\__tag_struct_format_Ref:n{[#1]}
-\cs_generate_variant:Nn\__tag_struct_format_Ref:n{e}
+\cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]}
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\@@_struct_write_obj:n}
@@ -1433,11 +1425,17 @@
           }
       },
   }
+%    \end{macrocode}
+% \end{macro}
+% \section{User commands}
+% We allow to set a language by default
+% \begin{macro}{\l_@@_struct_lang_tl}
+%    \begin{macrocode}
+\tl_new:N \l_@@_struct_lang_tl
 %</package>
 %    \end{macrocode}
 % \end{macro}
-% \section{User commands}
-%
+% 
 % \begin{macro}{\tag_struct_begin:n,\tag_struct_end:}
 %    \begin{macrocode}
 %<base>\cs_new_protected:Npn \tag_struct_begin:n #1 {\int_gincr:N \c at g_@@_struct_abs_int}
@@ -1464,6 +1462,18 @@
             { \int_use:N \c at g_@@_struct_abs_int }          
             { Type }
             { /StructElem }
+         \tl_if_empty:NF \l_@@_struct_lang_tl
+           {
+             \@@_struct_prop_gput:nne
+              { \int_use:N \c at g_@@_struct_abs_int }
+              { Lang }
+              { (\l_@@_struct_lang_tl) }
+           }   
+         \@@_struct_prop_gput:nnn
+            { \int_use:N \c at g_@@_struct_abs_int }          
+            { Type }
+            { /StructElem }
+            
         \tl_set:Nn \l_@@_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { @@ / struct} { #1 }
 %    \end{macrocode}
@@ -1626,7 +1636,7 @@
 %<debug>                 {no~parent:~stashed}
 %<debug>                 {
 %<debug>                   parent~structure:~\l_@@_struct_stack_parent_tmpa_tl\c_space_tl =~
-%<debug>                   \l_@@_get_parent_tmpa_tl
+%<debug>                   \prop_item:cn{ g__tag_struct_\l_@@_struct_stack_parent_tmpa_tl _prop }{S}
 %<debug>                 }  
 %<debug>             }
 %<debug>           \prop_gput:cne
@@ -1928,7 +1938,7 @@
 % \section{Attributes and attribute classes}
 %    \begin{macrocode}
 %<*header>
-\ProvidesExplPackage {tagpdf-attr-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-attr-code} {2024-03-27} {0.99a}
   {part of tagpdf - code related to attributes and attribute classes}
 %</header>
 %    \end{macrocode}
@@ -1936,12 +1946,12 @@
 %  \begin{variable}
 %   {
 %     ,\g_@@_attr_entries_prop
-%     ,\g_@@_attr_class_used_seq
+%     ,\g_@@_attr_class_used_prop
 %     ,\g_@@_attr_objref_prop
 %     ,\l_@@_attr_value_tl
 %   }
 % |\g_@@_attr_entries_prop| will store attribute names and their dictionary content.\\
-% |\g_@@_attr_class_used_seq| will hold the attributes which have been used as
+% |\g_@@_attr_class_used_prop| will hold the attributes which have been used as
 % class name.
 % |\l_@@_attr_value_tl| is used to build the attribute array or key.
 % Every time an attribute is used for the first time, and object is created
@@ -1950,10 +1960,14 @@
 %    \begin{macrocode}
 %<*package>
 \prop_new:N \g_@@_attr_entries_prop
-\seq_new:N  \g_@@_attr_class_used_seq
+\prop_new_linked:N \g_@@_attr_class_used_prop
 \tl_new:N   \l_@@_attr_value_tl
 \prop_new:N \g_@@_attr_objref_prop %will contain obj num of used attributes
 %    \end{macrocode}
+% This seq is currently kept for compability with the table code.
+%    \begin{macrocode}
+\seq_new:N\g_@@_attr_class_used_seq
+%    \end{macrocode}
 % \end{variable}
 % \subsection{Commands and keys}
 % \begin{macro}{\@@_attr_new_entry:nn,role/new-attribute (setup-key), newattribute (deprecated)}
@@ -2022,7 +2036,7 @@
              {
                \msg_error:nnn { tag } { attr-unknown } { ##1 }
              }
-           \seq_gput_left:Nn\g_@@_attr_class_used_seq { ##1}
+           \prop_gput:Nnn\g_@@_attr_class_used_prop { ##1} {}
          }
        \tl_set:Ne \l_@@_tmpa_tl
          {

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-tree.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -47,13 +47,13 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{implementation}
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-tree-code} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-tree-code} {2024-03-27} {0.99a}
  {part of tagpdf - code related to writing trees and dictionaries to the pdf}
 %</header>
 %    \end{macrocode}
@@ -92,6 +92,7 @@
       \int_step_inline:nnn{2}{\seq_count:N\g_@@_struct_stack_seq}
        {\tag_struct_end:}
     }
+   \msg_note:nn {tag}{tree-statistic} 
  }
 %    \end{macrocode}
 % \end{macro}
@@ -265,7 +266,8 @@
        { g_@@_struct_0_prop }
        { RoleMap }
        { \pdf_object_ref:n { @@/tree/rolemap } } 
-     \@@_struct_fill_kid_key:n { 0 }   
+     \@@_struct_fill_kid_key:n { 0 }
+     \prop_gremove:cn { g_@@_struct_0_prop } {S}   
      \@@_struct_get_dict_content:nN { 0 } \l_@@_tmpa_tl        
      \pdf_object_write:nne
          { @@/struct/0 }
@@ -503,22 +505,27 @@
 \cs_new_protected:Npn \@@_tree_write_classmap:
   {
     \tl_clear:N \l_@@_tmpa_tl
-    \seq_gremove_duplicates:N \g_@@_attr_class_used_seq
-    \seq_set_map:NNn \l_@@_tmpa_seq \g_@@_attr_class_used_seq
-      {
-        ##1\c_space_tl
-        <<
-          \prop_item:Nn
+%    \end{macrocode}
+% We process the older sec for compability with the table code. 
+% TODO: check if still needed
+%    \begin{macrocode}
+    \seq_map_inline:Nn \g_@@_attr_class_used_seq
+     {
+       \prop_gput:Nnn \g_@@_attr_class_used_prop {##1}{}
+     }
+    \prop_map_inline:Nn \g_@@_attr_class_used_prop
+     {
+       \tl_put_right:Ne \l_@@_tmpa_tl
+        {
+          ##1\c_space_tl
+          <<
+           \prop_item:Nn
             \g_@@_attr_entries_prop
             {##1}
-        >>
-      }
-    \tl_set:Ne \l_@@_tmpa_tl
-      {
-        \seq_use:Nn
-          \l_@@_tmpa_seq
-          { \iow_newline: }
-      }
+          >>
+         \iow_newline:
+        }
+     }
     \tl_if_empty:NF
       \l_@@_tmpa_tl
       {
@@ -585,15 +592,37 @@
       {
         \hook_use:n {tagpdf/finish/before}
         \@@_tree_final_checks:
+        \iow_term:n{Package~tagpdf~Info:~writing~ParentTree}
+        \@@_check_benchmark_tic:
         \@@_tree_write_parenttree:
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~IDTree}
+        \@@_check_benchmark_tic:
         \@@_tree_write_idtree:
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~RoleMap}
+        \@@_check_benchmark_tic:
         \@@_tree_write_rolemap:
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~ClassMap}
+        \@@_check_benchmark_tic:
         \@@_tree_write_classmap:
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~NameSpaces}
+        \@@_check_benchmark_tic:
         \@@_tree_write_namespaces:
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~StructElems}
+        \@@_check_benchmark_tic:
         \@@_tree_write_structelements: %this is rather slow!!
+        \@@_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~Root}
+        \@@_check_benchmark_tic:
         \@@_tree_write_structtreeroot:
+        \@@_check_benchmark_toc:
       }
   }
+%</package>
 %    \end{macrocode}
 % \end{macro}
 %
@@ -601,6 +630,7 @@
 % We need to add to the Page resources the |StructParents| entry, this is simply the
 % absolute page number.
 %    \begin{macrocode}
+%<*package>
 \hook_gput_code:nnn{begindocument}{tagpdf}
   {
     \bool_if:NT\g_@@_active_tree_bool

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf-user.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -46,7 +46,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.98x, released 2024-02-29}
+% \date{Version 0.99a, released 2024-03-27}
 % \maketitle
 % \begin{documentation}
 % \section{Setup commands}
@@ -309,7 +309,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*header>
-\ProvidesExplPackage {tagpdf-user} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-user} {2024-03-27} {0.99a}
   {tagpdf - user commands}
 %</header>
 %    \end{macrocode}
@@ -763,6 +763,7 @@
 % this will hold the structure number of the current text-unit.
 %    \begin{macrocode}
 \tl_new:N   \g_@@_para_main_struct_tl
+\tl_gset:Nn  \g_@@_para_main_struct_tl {1}
 \tl_new:N   \l_@@_para_tag_default_tl
 \tl_set:Nn  \l_@@_para_tag_default_tl { text }
 \tl_new:N   \l_@@_para_tag_tl
@@ -1197,6 +1198,18 @@
   {{\use:c{@@_mc_disable_marks:} #1}}
 %    \end{macrocode}
 % \end{macro}
+% \subsection{Language support}
+% 
+% With the following key the lang variable is set. All structures in the current group will
+% then set this lang variable.
+% \begin{macro}{test/lang (setup-key)}
+%    \begin{macrocode}
+\keys_define:nn { @@ / setup }
+  {
+    text / lang .tl_set:N = \l_@@_struct_lang_tl
+  }
+%    \end{macrocode}
+% \end{macro}
 % \subsection{Header and footer}
 % Header and footer should normally be tagged as artifacts. The following code
 % requires the new hooks.

Modified: trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/source/latex/tagpdf/tagpdf.dtx	2024-03-26 20:16:04 UTC (rev 70779)
@@ -87,7 +87,7 @@
 %    \begin{macrocode}
 %<@@=tag>
 %<*package>
-\ProvidesExplPackage {tagpdf} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf} {2024-03-27} {0.99a}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -113,7 +113,7 @@
 %    \end{macrocode}
 %<*debug>
 %    \begin{macrocode}
-\ProvidesExplPackage {tagpdf-debug} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug} {2024-03-27} {0.99a}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 %    \end{macrocode}
@@ -136,7 +136,7 @@
 % we define a base package with dummy functions
 %    \begin{macrocode}
 %<*base>
-\ProvidesExplPackage {tagpdf-base} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-base} {2024-03-27} {0.99a}
   {part of tagpdf - provide base, no-op versions of the user commands }
 %</base>
 %    \end{macrocode} 
@@ -487,7 +487,7 @@
 %    \begin{macrocode}
 \cs_set_protected:Npn \tag_stop:
   {
-%<debug>     \msg_note:nnx {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }      
+%<debug>     \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }      
     \int_incr:N \l_@@_tag_stop_int
     \bool_set_false:N \l_@@_active_struct_bool
     \bool_set_false:N \l_@@_active_mc_bool
@@ -504,7 +504,7 @@
         \bool_set_true:N \l_@@_active_socket_bool
         \@@_start_para_ints:
       }
-%<debug>    \msg_note:nnx {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }                   
+%<debug>    \msg_note:nne {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }                   
   }
 \cs_set_eq:NN\tagstop\tag_stop:
 \cs_set_eq:NN\tagstart\tag_start:  
@@ -512,7 +512,7 @@
 %    \begin{macrocode}
 \cs_set_protected:Npn \tag_stop:n #1
   {
-%<debug>    \msg_note:nnxx {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }{#1}           
+%<debug>    \msg_note:nnee {tag / debug }{tag-stop}{ \int_use:N \l_@@_tag_stop_int }{#1}           
     \int_incr:N \l_@@_tag_stop_int
     \bool_set_false:N \l_@@_active_struct_bool
     \bool_set_false:N \l_@@_active_mc_bool
@@ -529,7 +529,7 @@
         \bool_set_true:N \l_@@_active_socket_bool
         \@@_start_para_ints:
       } 
-%<debug>    \msg_note:nnxx {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }{#1}             
+%<debug>    \msg_note:nnee {tag / debug }{tag-start}{ \int_use:N \l_@@_tag_stop_int }{#1}             
   }
 %</package|debug>
 %<*base>

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-base.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -25,7 +25,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-base} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-base} {2024-03-27} {0.99a}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \AddToHook{begindocument}
  {
@@ -85,7 +85,6 @@
 
 %% File: tagpdf-checks.dtx
 
-
 \cs_new:Npn \tag_get:n #1   { \use:c {__tag_get_data_#1: } }
 \prg_new_conditional:Npnn \tag_if_active: { p , T , TF, F }
   { \prg_return_false: }

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-generic.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-debug-generic} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug-generic} {2024-03-27} {0.99a}
  {part of tagpdf - debugging code related to marking chunks - generic mode}
 \cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug-lua.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-debug-lua} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug-lua} {2024-03-27} {0.99a}
  {part of tagpdf - debugging code related to marking chunks - lua mode}
 \cs_set_protected:Npn \__tag_mc_handle_stash:n #1 %1 mcidnum
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-debug.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -26,7 +26,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-debug} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-debug} {2024-03-27} {0.99a}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {}
@@ -34,7 +34,7 @@
 
 \cs_set_protected:Npn \tag_stop:
   {
-     \msg_note:nnx {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }
+     \msg_note:nne {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }
     \int_incr:N \l__tag_tag_stop_int
     \bool_set_false:N \l__tag_active_struct_bool
     \bool_set_false:N \l__tag_active_mc_bool
@@ -51,13 +51,13 @@
         \bool_set_true:N \l__tag_active_socket_bool
         \__tag_start_para_ints:
       }
-    \msg_note:nnx {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }
+    \msg_note:nne {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }
   }
 \cs_set_eq:NN\tagstop\tag_stop:
 \cs_set_eq:NN\tagstart\tag_start:
 \cs_set_protected:Npn \tag_stop:n #1
   {
-    \msg_note:nnxx {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }{#1}
+    \msg_note:nnee {tag / debug }{tag-stop}{ \int_use:N \l__tag_tag_stop_int }{#1}
     \int_incr:N \l__tag_tag_stop_int
     \bool_set_false:N \l__tag_active_struct_bool
     \bool_set_false:N \l__tag_active_mc_bool
@@ -74,7 +74,7 @@
         \bool_set_true:N \l__tag_active_socket_bool
         \__tag_start_para_ints:
       }
-    \msg_note:nnxx {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }{#1}
+    \msg_note:nnee {tag / debug }{tag-start}{ \int_use:N \l__tag_tag_stop_int }{#1}
   }
 \bool_if:NTF \g__tag_mode_lua_bool
   {
@@ -85,7 +85,6 @@
   }
 %% File: tagpdf-checks.dtx
 
-
 \msg_new:nnn { tag/debug } { show-struct }
   {
     =========================\\
@@ -331,6 +330,18 @@
             { \int_use:N \c at g__tag_struct_abs_int }
             { Type }
             { /StructElem }
+         \tl_if_empty:NF \l__tag_struct_lang_tl
+           {
+             \__tag_struct_prop_gput:nne
+              { \int_use:N \c at g__tag_struct_abs_int }
+              { Lang }
+              { (\l__tag_struct_lang_tl) }
+           }
+         \__tag_struct_prop_gput:nnn
+            { \int_use:N \c at g__tag_struct_abs_int }
+            { Type }
+            { /StructElem }
+
         \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { __tag / struct} { #1 }
         \__tag_struct_set_tag_info:eVV
@@ -462,7 +473,7 @@
                  {no~parent:~stashed}
                  {
                    parent~structure:~\l__tag_struct_stack_parent_tmpa_tl\c_space_tl =~
-                   \l__tag_get_parent_tmpa_tl
+                   \prop_item:cn{ g__tag_struct_\l__tag_struct_stack_parent_tmpa_tl _prop }{S}
                  }
              }
            \prop_gput:cne

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-luatex.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-backend.dtx
-\ProvidesExplFile {tagpdf-luatex.def} {2024-02-29} {0.98x}
+\ProvidesExplFile {tagpdf-luatex.def} {2024-03-27} {0.99a}
   {tagpdf~driver~for~luatex}
 {
   \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-generic.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-generic.dtx
-\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2024-03-27} {0.99a}
  {part of tagpdf - code related to marking chunks - generic mode}
 \tl_new:N \l__tag_mc_ref_abspage_tl
 

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-mc-code-lua.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2024-03-27} {0.99a}
   {tagpdf - mc code only for the luamode }
 \hook_gput_code:nnn{begindocument}{tagpdf/mc}
   {

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex-book.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2024-03-27} {0.99a}
 %% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
 chapter,       H1,pdf2,
 section,       H2,pdf2,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-latex.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-03-27} {0.99a}
 %% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
 title,        Title,    pdf2,
 part,         Title,    pdf2,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-mathml.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2024-03-27} {0.99a}
 abs,abs,mathml,
 and,and,mathml,
 annotation,annotation,mathml,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2024-03-27} {0.99a}
 %%  {pdf}   {http://iso.org/pdf/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf,D,
 Document,Document,pdf,D,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-ns-pdf2.def	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2024-03-27} {0.99a}
 %%  {pdf2}  {http://iso.org/pdf2/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf2,D,
 Document,Document,pdf2,D,

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child-2.csv	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2024-03-27} {0.99a}
 ,,,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,∅

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf-parent-child.csv	2024-03-26 20:16:04 UTC (rev 70779)
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-data.dtx
-%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-02-29} {0.98x}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2024-03-27} {0.99a}
 ,,,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,∅,∅

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.lua	2024-03-26 20:16:04 UTC (rev 70779)
@@ -24,8 +24,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.98x",       --TAGVERSION
-    date          = "2024-02-29", --TAGDATE
+    version       = "0.99a",       --TAGVERSION
+    date          = "2024-03-27", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
@@ -377,7 +377,7 @@
  return head
 end
 local function __tag_pdf_object_ref (name)
-   local tokenname = 'c__pdf_backend_object_'..name..'_int'
+   local tokenname = 'c__pdf_object_'..name..'_int'
    local object = token.create(tokenname).mode ..' 0 R'
    return object
 end

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdf.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -28,7 +28,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdf} {2024-03-27} {0.99a}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -271,7 +271,6 @@
   }
 %% File: tagpdf-checks.dtx
 
-
 \msg_new:nnn { tag } {mc-nested} { nested~marked~content~found~-~mcid~#1 }
 \msg_new:nnn { tag } {mc-tag-missing} { required~tag~missing~-~mcid~#1 }
 \msg_new:nnn { tag } {mc-label-unknown}
@@ -314,6 +313,15 @@
     The~structures~are~automatically~closed,\\
     but~their~nesting~can~be~wrong.
   }
+\msg_new:nnn { tag } {tree-statistic}
+  {
+    Finalizing~the~tagging~structure:\\
+    Writing~out~\c_tilde_str
+    \int_use:N\c at g__tag_struct_abs_int\c_space_tl~structure~objects\\
+    with~\c_tilde_str
+    \int_use:N\c at g__tag_MCID_abs_int\c_space_tl'MC'~leaf~nodes.\\
+    Be~patient~if~there~are~lots~of~objects!
+  }
 \msg_new:nnn { tag } {attr-unknown}  { attribute~#1~is~unknown}
 \msg_new:nnn { tag } {role-missing}     { tag~#1~has~no~role~assigned  }
 \msg_new:nnn { tag } {role-unknown}     { role~#1~is~not~known  }
@@ -583,6 +591,16 @@
     { \prg_return_true: }
     { \prg_return_false: }
  }
+\cs_new_protected:Npn \__tag_check_benchmark_tic:{}
+\cs_new_protected:Npn \__tag_check_benchmark_toc:{}
+\cs_new_protected:Npn \tag_check_benchmark_on:
+  {
+    \cs_if_exist:NT \benchmark_tic:
+     {
+       \cs_set_eq:NN \__tag_check_benchmark_tic: \benchmark_tic:
+       \cs_set_eq:NN \__tag_check_benchmark_toc: \benchmark_toc:
+     }
+  }
 %% File: tagpdf-mc-shared.dtx
 
 \cs_new:Npn \__tag_get_mc_abs_cnt: { \int_use:N \c at g__tag_MCID_abs_int }
@@ -748,6 +766,7 @@
       \int_step_inline:nnn{2}{\seq_count:N\g__tag_struct_stack_seq}
        {\tag_struct_end:}
     }
+   \msg_note:nn {tag}{tree-statistic}
  }
 \pdf_object_new:n { __tag/struct/0 }
 \tl_new:N   \g__tag_tree_openaction_struct_tl
@@ -855,6 +874,7 @@
        { RoleMap }
        { \pdf_object_ref:n { __tag/tree/rolemap } }
      \__tag_struct_fill_kid_key:n { 0 }
+     \prop_gremove:cn { g__tag_struct_0_prop } {S}
      \__tag_struct_get_dict_content:nN { 0 } \l__tag_tmpa_tl
      \pdf_object_write:nne
          { __tag/struct/0 }
@@ -999,22 +1019,23 @@
 \cs_new_protected:Npn \__tag_tree_write_classmap:
   {
     \tl_clear:N \l__tag_tmpa_tl
-    \seq_gremove_duplicates:N \g__tag_attr_class_used_seq
-    \seq_set_map:NNn \l__tag_tmpa_seq \g__tag_attr_class_used_seq
-      {
-        ##1\c_space_tl
-        <<
-          \prop_item:Nn
+    \seq_map_inline:Nn \g__tag_attr_class_used_seq
+     {
+       \prop_gput:Nnn \g__tag_attr_class_used_prop {##1}{}
+     }
+    \prop_map_inline:Nn \g__tag_attr_class_used_prop
+     {
+       \tl_put_right:Ne \l__tag_tmpa_tl
+        {
+          ##1\c_space_tl
+          <<
+           \prop_item:Nn
             \g__tag_attr_entries_prop
             {##1}
-        >>
-      }
-    \tl_set:Ne \l__tag_tmpa_tl
-      {
-        \seq_use:Nn
-          \l__tag_tmpa_seq
-          { \iow_newline: }
-      }
+          >>
+         \iow_newline:
+        }
+     }
     \tl_if_empty:NF
       \l__tag_tmpa_tl
       {
@@ -1063,13 +1084,34 @@
       {
         \hook_use:n {tagpdf/finish/before}
         \__tag_tree_final_checks:
+        \iow_term:n{Package~tagpdf~Info:~writing~ParentTree}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_parenttree:
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~IDTree}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_idtree:
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~RoleMap}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_rolemap:
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~ClassMap}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_classmap:
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~NameSpaces}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_namespaces:
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~StructElems}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_structelements: %this is rather slow!!
+        \__tag_check_benchmark_toc:
+        \iow_term:n{Package~tagpdf~Info:~writing~Root}
+        \__tag_check_benchmark_tic:
         \__tag_tree_write_structtreeroot:
+        \__tag_check_benchmark_toc:
       }
   }
 \hook_gput_code:nnn{begindocument}{tagpdf}
@@ -2067,10 +2109,9 @@
 \cs_new_protected:Npn\__tag_struct_exchange_kid_command:N #1 %#1 = seq var
   {
     \seq_gpop_left:NN #1 \l__tag_tmpa_tl
-    \regex_replace_once:nnN
-      { \c{\__tag_mc_insert_mcid_kids:n} }
-      { \c{\__tag_mc_insert_mcid_single_kids:n} }
-      \l__tag_tmpa_tl
+    \tl_replace_once:Nnn \l__tag_tmpa_tl
+     {\__tag_mc_insert_mcid_kids:n}
+     {\__tag_mc_insert_mcid_single_kids:n}
     \seq_gput_left:NV #1 \l__tag_tmpa_tl
   }
 
@@ -2158,34 +2199,20 @@
 \cs_new_protected:Npn \__tag_struct_get_dict_content:nN #1 #2 %#1: stucture num
   {
     \tl_clear:N #2
-    \seq_map_inline:cn
+    \prop_map_inline:cn { g__tag_struct_#1_prop }
       {
-        c__tag_struct_
-         \int_compare:nNnTF{#1}={0}{StructTreeRoot}{StructElem}
-         _entries_seq
-      }
-      {
-        \tl_put_right:Ne
-          #2
+        \tl_put_right:Ne #2
           {
-             \prop_if_in:cnT
-               { g__tag_struct_#1_prop }
-               { ##1 }
-               {
-                 \c_space_tl/##1~
-                 \cs_if_exist_use:cTF {__tag_struct_format_##1:e}
-                   {
-                     { \prop_item:cn{ g__tag_struct_#1_prop } { ##1 } }
-                   }
-                   {
-                     \prop_item:cn{ g__tag_struct_#1_prop } { ##1 }
-                   }
-               }
+           \cs_if_exist_use:cTF {__tag_struct_format_##1:nn}
+             {{##1}{##2}}
+             {\c_space_tl/##1~##2}
           }
       }
   }
-\cs_new:Nn\__tag_struct_format_Ref:n{[#1]}
-\cs_generate_variant:Nn\__tag_struct_format_Ref:n{e}
+\cs_new:Nn\__tag_struct_format_rolemap:nn{}
+\cs_new:Nn\__tag_struct_format_parentrole:nn{}
+
+\cs_new:Nn\__tag_struct_format_Ref:nn{\c_space_tl/#1~[#2]}
 \cs_new_protected:Npn \__tag_struct_write_obj:n #1 % #1 is the struct num
   {
     \pdf_object_if_exist:nTF { __tag/struct/#1 }
@@ -2534,6 +2561,7 @@
           }
       },
   }
+\tl_new:N \l__tag_struct_lang_tl
 \cs_set_protected:Npn \tag_struct_begin:n #1 %#1 key-val
   {
 \__tag_check_if_active_struct:T
@@ -2550,6 +2578,18 @@
             { \int_use:N \c at g__tag_struct_abs_int }
             { Type }
             { /StructElem }
+         \tl_if_empty:NF \l__tag_struct_lang_tl
+           {
+             \__tag_struct_prop_gput:nne
+              { \int_use:N \c at g__tag_struct_abs_int }
+              { Lang }
+              { (\l__tag_struct_lang_tl) }
+           }
+         \__tag_struct_prop_gput:nnn
+            { \int_use:N \c at g__tag_struct_abs_int }
+            { Type }
+            { /StructElem }
+
         \tl_set:Nn \l__tag_struct_stack_parent_tmpa_tl {-1}
         \keys_set:nn { __tag / struct} { #1 }
         \__tag_struct_set_tag_info:eVV
@@ -2852,9 +2892,10 @@
 
 
 \prop_new:N \g__tag_attr_entries_prop
-\seq_new:N  \g__tag_attr_class_used_seq
+\prop_new_linked:N \g__tag_attr_class_used_prop
 \tl_new:N   \l__tag_attr_value_tl
 \prop_new:N \g__tag_attr_objref_prop %will contain obj num of used attributes
+\seq_new:N\g__tag_attr_class_used_seq
 \cs_new_protected:Npn \__tag_attr_new_entry:nn #1 #2 %#1:name, #2: content
   {
     \prop_gput:Nen \g__tag_attr_entries_prop
@@ -2889,7 +2930,7 @@
              {
                \msg_error:nnn { tag } { attr-unknown } { ##1 }
              }
-           \seq_gput_left:Nn\g__tag_attr_class_used_seq { ##1}
+           \prop_gput:Nnn\g__tag_attr_class_used_prop { ##1} {}
          }
        \tl_set:Ne \l__tag_tmpa_tl
          {
@@ -3247,6 +3288,7 @@
 \int_new:N  \g__tag_para_main_begin_int
 \int_new:N  \g__tag_para_main_end_int
 \tl_new:N   \g__tag_para_main_struct_tl
+\tl_gset:Nn  \g__tag_para_main_struct_tl {1}
 \tl_new:N   \l__tag_para_tag_default_tl
 \tl_set:Nn  \l__tag_para_tag_default_tl { text }
 \tl_new:N   \l__tag_para_tag_tl
@@ -3539,6 +3581,10 @@
 \renewcommand\tagpdfparaOff{\bool_set_false:N \l__tag_para_bool}
 \NewDocumentCommand\tagpdfsuppressmarks{m}
   {{\use:c{__tag_mc_disable_marks:} #1}}
+\keys_define:nn { __tag / setup }
+  {
+    text / lang .tl_set:N = \l__tag_struct_lang_tl
+  }
 \cs_new_protected:Npn\__tag_hook_kernel_before_head:{}
 \cs_new_protected:Npn\__tag_hook_kernel_after_head:{}
 \cs_new_protected:Npn\__tag_hook_kernel_before_foot:{}

Modified: trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-03-26 20:15:52 UTC (rev 70778)
+++ trunk/Master/texmf-dist/tex/latex/tagpdf/tagpdfdocu-patches.sty	2024-03-26 20:16:04 UTC (rev 70779)
@@ -1,5 +1,5 @@
 %\RequirePackage[enable-debug]{expl3}[2018/06/14]
-\ProvidesExplPackage {tagpdfdocu-patches} {2024-02-29} {0.98x}
+\ProvidesExplPackage {tagpdfdocu-patches} {2024-03-27} {0.99a}
  {patches/commands for the tagpdf documentation}
 \RequirePackage{etoolbox,xpatch}
 
@@ -69,15 +69,17 @@
    }
       
 % ======== marginnote ==========
+% 2024-03-23 currently marginnote is no longer used, we use marginpar
 % 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
-\renewcommand*{\mn at parboxrestore}{\tagpdfparaOff}%
+%\renewcommand*{\mn at parboxrestore}{\tagpdfparaOff}%
 
-\NewDocumentCommand\sidenote{m}
- {
-   \tag_mc_artifact_group_begin:n{notype}\tagpdfparaOff\marginnote{#1}\tag_mc_artifact_group_end:
- }
+%\NewDocumentCommand\sidenote{m}
+% {%
+%   %\tag_mc_artifact_group_begin:n{notype}\tagpdfparaOff\marginnote{#1}\tag_mc_artifact_group_end:
+%   \marginpar{#1}%
+% }
 
 \ExplSyntaxOff
 % ======== tikzpicture ==========



More information about the tex-live-commits mailing list.