[latex3-commits] [git/LaTeX3-latex3-latex2e] cleanup-footnote-lab: start support for footnote in longtable, WIP [ci-skip] (8ede7a07)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Jan 29 23:56:53 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : cleanup-footnote-lab
Link       : https://github.com/latex3/latex2e/commit/8ede7a07c0ca34430b968fa4053cc6c5be23dbf0

>---------------------------------------------------------------

commit 8ede7a07c0ca34430b968fa4053cc6c5be23dbf0
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Jan 29 23:56:53 2023 +0100

    start support for footnote in longtable, WIP [ci-skip]


>---------------------------------------------------------------

8ede7a07c0ca34430b968fa4053cc6c5be23dbf0
 required/latex-lab/latex-lab-footnotes.dtx        |  15 +++-
 texmf/tex/latex/tagpdf/tagpdf-base.sty            |   9 +-
 texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty   |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-debug.sty           |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-luatex.def          |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-mc-code-generic.sty |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty     |   4 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def   |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-latex-inline.def |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-latex.def        |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-mathml.def       |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def          |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-ns-pdf2.def         |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-parent-child-2.csv  |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-parent-child.csv    |   2 +-
 texmf/tex/latex/tagpdf/tagpdf.lua                 |   4 +-
 texmf/tex/latex/tagpdf/tagpdf.sty                 | 104 +++++++++++++++++++++-
 17 files changed, 136 insertions(+), 24 deletions(-)

diff --git a/required/latex-lab/latex-lab-footnotes.dtx b/required/latex-lab/latex-lab-footnotes.dtx
index 4392cff4..b322bd89 100644
--- a/required/latex-lab/latex-lab-footnotes.dtx
+++ b/required/latex-lab/latex-lab-footnotes.dtx
@@ -1684,6 +1684,10 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+\tl_new:N \l_@@_dflt_struct_tl
+\tl_set:Nn \l_@@_dflt_struct_tl {1}
+%    \end{macrocode}
 % kernel hook for tagging (2 args)
 % this sets the structure around the whole text
 %
@@ -1691,7 +1695,16 @@
 \cs_new_protected:Npn \tag at FENote #1#2 % #1 config point, \insert\footins  #2 content
   {
     \tag_mc_end_push:
-    \tag_struct_begin:n { tag=footnote }
+%    \end{macrocode}
+% test if a footnote is allowed, if not move up to the document structure.
+%    \begin{macrocode}
+    \tag_check_child:nnTF {FENote}{pdf2}
+      { 
+        \tag_struct_begin:n { tag=footnote }
+      }
+      {  
+        \tag_struct_begin:n { tag=footnote,parent=\l_@@_dflt_struct_tl }
+      }  
 %    \end{macrocode}
 % Store the current structure number for labels.
 %    \begin{macrocode}
diff --git a/texmf/tex/latex/tagpdf/tagpdf-base.sty b/texmf/tex/latex/tagpdf/tagpdf-base.sty
index 3da06a2f..94033ad9 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-base.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf-base.sty
@@ -10,6 +10,7 @@
 %% tagpdf-struct.dtx  (with options: `base')
 %% tagpdf-checks.dtx  (with options: `base')
 %% tagpdf-user.dtx  (with options: `base')
+%% tagpdf-roles.dtx  (with options: `base')
 %% 
 %% Copyright (C) 2019-2022 Ulrike Fischer
 %% 
@@ -24,7 +25,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-base} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf-base} {2023-01-24} {0.98b}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \AddToHook{begindocument}
  {
@@ -40,8 +41,8 @@
 
 \cs_new_protected:Npn \tag_stop:{}
 \cs_new_protected:Npn \tag_start:{}
-\cs_new_protected:Npn \tag_stop:n{}
-\cs_new_protected:Npn \tag_start:n{}
+\cs_new_protected:Npn \tag_stop:n  #1 {}
+\cs_new_protected:Npn \tag_start:n #1 {}
 
 %% File: tagpdf-mc-generic.dtx
 \cs_new_protected:Npn \tag_mc_begin:n #1 { \__tag_whatsits: }
@@ -107,6 +108,8 @@
   }
 \newcommand\tagpdfparaOn {}
 \newcommand\tagpdfparaOff{}
+%% File: tagpdf-roles.dtx
+\prg_new_protected_conditional:Npnn \tag_check_child:nn #1 #2 {T,F,TF}{\prg_return_true:}
 %% 
 %%
 %% End of file `tagpdf-base.sty'.
diff --git a/texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty b/texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty
index ea2f3113..367a746c 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty
+++ b/texmf/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} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf-debug-generic} {2023-01-24} {0.98b}
  {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/texmf/tex/latex/tagpdf/tagpdf-debug.sty b/texmf/tex/latex/tagpdf/tagpdf-debug.sty
index 944dd28d..bac841f7 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-debug.sty
+++ b/texmf/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} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf-debug} {2023-01-24} {0.98b}
   { 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/texmf/tex/latex/tagpdf/tagpdf-luatex.def b/texmf/tex/latex/tagpdf/tagpdf-luatex.def
index b3c2876b..021c829a 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-luatex.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+\ProvidesExplFile {tagpdf-luatex.def} {2023-01-24} {0.98b}
   {tagpdf~driver~for~luatex}
 {
   \fontencoding{TU}\fontfamily{lmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{10pt}\selectfont
diff --git a/texmf/tex/latex/tagpdf/tagpdf-mc-code-generic.sty b/texmf/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
index b345e736..254b5c1c 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-mc-code-generic.sty
+++ b/texmf/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} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-01-24} {0.98b}
  {part of tagpdf - code related to marking chunks - generic mode}
 \__tag_prop_new:N \g__tag_MCID_byabspage_prop
 
diff --git a/texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty b/texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
index 30ad779f..e7ec855e 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
+++ b/texmf/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} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-01-24} {0.98b}
   {tagpdf - mc code only for the luamode }
 \hook_gput_code:nnn{begindocument}{tagpdf/mc}
   {
@@ -80,7 +80,7 @@
       =
       {\lua_now:e
          {
-           tex.print(tex.getattribute(luatexbase.attributes.g__tag_mc_type_attr))
+           tex.print(\int_use:N \c_document_cctab,tex.getattribute(luatexbase.attributes.g__tag_mc_type_attr))
          }
       }
       { \prg_return_false:  }
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def b/texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def
index 42d51a6d..c73e98af 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-01-24} {0.98b}
 %% {latex-book} {https://www.latex-project.org/ns/book/2022}{}
 chapter,       H1,pdf2,
 section,       H2,pdf2,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-latex-inline.def b/texmf/tex/latex/tagpdf/tagpdf-ns-latex-inline.def
index 5dcec775..05f27502 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-latex-inline.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-01-24} {0.98b}
 %% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{}
 chapter,       Span, pdf2,
 section,       Span, pdf2,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-latex.def b/texmf/tex/latex/tagpdf/tagpdf-ns-latex.def
index 4d511564..b6275cd8 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-latex.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-01-24} {0.98b}
 %% {latex} {https://www.latex-project.org/ns/dflt/2022}{}
 title,        Title,    pdf2,
 part,         Title,    pdf2,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-mathml.def b/texmf/tex/latex/tagpdf/tagpdf-ns-mathml.def
index 0d0096c6..a3e97ada 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-mathml.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-01-24} {0.98b}
 abs,,,
 and,,,
 annotation,,,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def b/texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def
index 693faa9b..b6bb6391 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-01-24} {0.98b}
 %%  {pdf}   {http://iso.org/pdf/ssn}{}
 StructTreeRoot,StructTreeRoot,pdf,D,
 Document,Document,pdf,D,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-pdf2.def b/texmf/tex/latex/tagpdf/tagpdf-ns-pdf2.def
index fbc68fa9..6c2c31df 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-ns-pdf2.def
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-01-24} {0.98b}
 %%  {pdf2}  {http://iso.org/pdf2/ssn}{}
 Document,Document,pdf2,D,
 Part,Part,pdf2,G,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-parent-child-2.csv b/texmf/tex/latex/tagpdf/tagpdf-parent-child-2.csv
index 43263cb5..96faf168 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-parent-child-2.csv
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-01-24} {0.98b}
 ,,,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/texmf/tex/latex/tagpdf/tagpdf-parent-child.csv b/texmf/tex/latex/tagpdf/tagpdf-parent-child.csv
index 39567b05..cd410980 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-parent-child.csv
+++ b/texmf/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} {2022-12-22} {0.98a}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-01-24} {0.98b}
 ,,,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/texmf/tex/latex/tagpdf/tagpdf.lua b/texmf/tex/latex/tagpdf/tagpdf.lua
index 676e7a99..b4accfdb 100644
--- a/texmf/tex/latex/tagpdf/tagpdf.lua
+++ b/texmf/tex/latex/tagpdf/tagpdf.lua
@@ -24,8 +24,8 @@
 
 local ProvidesLuaModule = {
     name          = "tagpdf",
-    version       = "0.98a",       --TAGVERSION
-    date          = "2022-12-22", --TAGDATE
+    version       = "0.98b",       --TAGVERSION
+    date          = "2023-01-24", --TAGDATE
     description   = "tagpdf lua code",
     license       = "The LATEX Project Public License 1.3c"
 }
diff --git a/texmf/tex/latex/tagpdf/tagpdf.sty b/texmf/tex/latex/tagpdf/tagpdf.sty
index ebd29646..ac06c3e7 100644
--- a/texmf/tex/latex/tagpdf/tagpdf.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf.sty
@@ -28,7 +28,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf} {2022-12-22} {0.98a}
+\ProvidesExplPackage {tagpdf} {2023-01-24} {0.98b}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -70,6 +70,7 @@
                 {
                   {abspage} { \int_use:N \g_shipout_readonly_int}
                   {tagmcabs}{ \int_use:N \c at g__tag_MCID_abs_int }
+                  {tagstruct}{\int_use:N \c at g__tag_struct_abs_int }
                 }
             }
        }
@@ -744,6 +745,54 @@
           { \pdf_object_ref:n { __tag/struct/0 } }
       }
   }
+\int_new:N\g__tag_tree_id_pad_int
+\cs_generate_variant:Nn \tl_count:n {e}
+\hook_gput_code:nnn{begindocument}{tagpdf}
+ {
+   \int_gset:Nn\g__tag_tree_id_pad_int
+    {\tl_count:e { \__tag_ref_value_lastpage:nn{tagstruct}{1000}}+1}
+ }
+
+\cs_new_protected:Npn \__tag_tree_write_idtree:
+  {
+    \tl_clear:N \l__tag_tmpa_tl
+    \tl_clear:N \l__tag_tmpb_tl
+    \int_zero:N \l__tag_tmpa_int
+    \int_step_inline:nn {\c at g__tag_struct_abs_int}
+      {
+        \int_incr:N\l__tag_tmpa_int
+        \tl_put_right:Nx \l__tag_tmpa_tl
+          {
+            \__tag_struct_get_id:n{##1}~\pdf_object_ref:n{__tag/struct/##1}~
+          }
+        \int_compare:nNnF {\l__tag_tmpa_int}<{50} %
+          {
+            \pdf_object_unnamed_write:nx {dict}
+              { /Limits~[\__tag_struct_get_id:n{##1-\l__tag_tmpa_int+1}~\__tag_struct_get_id:n{##1}]
+                /Names~[\l__tag_tmpa_tl]
+              }
+            \tl_put_right:Nx\l__tag_tmpb_tl {\pdf_object_ref_last:\c_space_tl}
+            \int_zero:N \l__tag_tmpa_int
+            \tl_clear:N \l__tag_tmpa_tl
+          }
+      }
+     \tl_if_empty:NF \l__tag_tmpa_tl
+      {
+        \pdf_object_unnamed_write:nx {dict}
+          {
+           /Limits~
+             [\__tag_struct_get_id:n{\c at g__tag_struct_abs_int-\l__tag_tmpa_int+1}~
+              \__tag_struct_get_id:n{\c at g__tag_struct_abs_int}]
+           /Names~[\l__tag_tmpa_tl]
+          }
+        \tl_put_right:Nx\l__tag_tmpb_tl {\pdf_object_ref_last:}
+      }
+      \pdf_object_unnamed_write:nx {dict}{/Kids~[\l__tag_tmpb_tl]}
+      \__tag_prop_gput:cnx
+          { g__tag_struct_0_prop }
+          { IDTree }
+          { \pdf_object_ref_last: }
+   }
 \pdf_version_compare:NnTF < {2.0}
  {
    \cs_new_protected:Npn \__tag_tree_write_structtreeroot:
@@ -756,7 +805,14 @@
           { g__tag_struct_0_prop }
           { RoleMap }
           { \pdf_object_ref:n { __tag/tree/rolemap } }
-        \__tag_struct_write_obj:n { 0 }
+        \__tag_struct_fill_kid_key:n { 0 }
+        \__tag_struct_get_dict_content:nN { 0 } \l__tag_tmpa_tl
+        \pdf_object_write:nnx
+            { __tag/struct/0 }
+            {dict}
+            {
+             \l__tag_tmpa_tl
+            }
      }
  }
  {
@@ -766,7 +822,14 @@
           { g__tag_struct_0_prop }
           { ParentTree }
           { \pdf_object_ref:n { __tag/tree/parenttree } }
-        \__tag_struct_write_obj:n { 0 }
+        \__tag_struct_fill_kid_key:n { 0 }
+        \__tag_struct_get_dict_content:nN { 0 } \l__tag_tmpa_tl
+        \pdf_object_write:nnx
+            { __tag/struct/0 }
+            {dict}
+            {
+             \l__tag_tmpa_tl
+            }
      }
  }
 \cs_new_protected:Npn \__tag_tree_write_structelements:
@@ -966,6 +1029,7 @@
         \hook_use:n {tagpdf/finish/before}
         \__tag_tree_final_checks:
         \__tag_tree_write_parenttree:
+        \__tag_tree_write_idtree:
         \__tag_tree_write_rolemap:
         \__tag_tree_write_classmap:
         \__tag_tree_write_namespaces:
@@ -1645,6 +1709,22 @@
   }
 \cs_generate_variant:Nn\__tag_check_parent_child:nnN {VVN}
 \cs_generate_variant:Nn\__tag_check_parent_child:nnnnN {VVVVN,nVnVN,VVnnN}
+\prg_set_protected_conditional:Npnn \tag_check_child:nn #1 #2 {T,F,TF}
+ {
+   \seq_get:NN\g__tag_struct_stack_seq\l__tag_tmpa_tl
+   \__tag_struct_get_tag_info:eNN
+      {\l__tag_tmpa_tl}
+      \l__tag_get_parent_tmpa_tl
+      \l__tag_get_parent_tmpb_tl
+   \__tag_check_parent_child:VVnnN
+     \l__tag_get_parent_tmpa_tl
+     \l__tag_get_parent_tmpb_tl
+      {#1}{#2}
+      \l__tag_parent_child_check_tl
+   \int_compare:nNnTF {  \l__tag_parent_child_check_tl } < {0}
+      {\prg_return_false:}
+      {\prg_return_true:}
+ }
 \tl_new:N \l__tag_role_remap_tag_tl
 \tl_new:N \l__tag_role_remap_NS_tl
 \cs_new_protected:Npn \__tag_role_remap: {  }
@@ -1832,6 +1912,16 @@
   { 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
+  {
+    (
+     ID.
+     \prg_replicate:nn
+      { \int_abs:n{\g__tag_tree_id_pad_int - \tl_count:e { \int_to_arabic:n { #1 } }} }
+      { 0 }
+     \int_to_arabic:n { #1 }
+    )
+  }
 
 \pdf_version_compare:NnTF < {2.0}
  {
@@ -2042,7 +2132,8 @@
             { __tag/struct/#1 }
             {dict}
             {
-              \l__tag_tmpa_tl
+              \l__tag_tmpa_tl\c_space_tl
+              /ID~\__tag_struct_get_id:n{#1}
             }
       }
       {
@@ -2095,6 +2186,10 @@
        \prop_item:cn {g__tag_struct_\g__tag_struct_stack_current_tl _prop}{S}
      }
   }
+\cs_new:Npn \__tag_get_data_struct_id:
+  {
+    \__tag_struct_get_id:n {\g__tag_struct_stack_current_tl}
+  }
 \keys_define:nn { __tag / struct }
   {
     label .tl_set:N      = \l__tag_struct_key_label_tl,
@@ -2927,6 +3022,7 @@
   }
 \AddToHook{begindocument/before}
  {
+   \@ifundefined{@mult at ptagging@hook}{\RequirePackage{output-patches-tmp-ltx}}{} %
    \bool_if:NF \g__tag_mode_lua_bool
      {
         \cs_if_exist:NT \@kernel at before@footins





More information about the latex3-commits mailing list.