[latex3-commits] [latex3/latex2e] updatetagpdf-098r: update tagpdf (06d6340a)

github at latex-project.org github at latex-project.org
Tue Dec 19 23:55:37 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : updatetagpdf-098r
Link       : https://github.com/latex3/latex2e/commit/06d6340a675dc5314309126b801205f55ffad385

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

commit 06d6340a675dc5314309126b801205f55ffad385
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Dec 19 23:55:37 2023 +0100

    update tagpdf


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

06d6340a675dc5314309126b801205f55ffad385
 texmf/tex/latex/tagpdf/tagpdf-base.sty            |   8 +-
 texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty   |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-debug-lua.sty       |   2 +-
 texmf/tex/latex/tagpdf/tagpdf-debug.sty           |  67 ++++++++-
 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     |   2 +-
 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                 | 160 +++++++++++++---------
 17 files changed, 177 insertions(+), 88 deletions(-)

diff --git a/texmf/tex/latex/tagpdf/tagpdf-base.sty b/texmf/tex/latex/tagpdf/tagpdf-base.sty
index a85a5eca..042dbf92 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-base.sty
+++ b/texmf/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-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-base} {2023-12-18} {0.98r}
   {part of tagpdf - provide base, no-op versions of the user commands }
 \AddToHook{begindocument}
  {
@@ -137,9 +137,11 @@
   {
     \tag_struct_use:n {#1}
   }
-\AddToHook{begindocument}
- {\immediate\write\@mainaux{\string\providecommand\string\newlabeldata[2]{}}}
+\providecommand\tag_socket_use:n[1]{}
+\providecommand\tag_socket_use:nn[2]{}
+\providecommand\UseTaggingSocket[1]{}
 \bool_new:N \l__tag_para_flattened_bool
+\bool_new:N \l__tag_para_bool
 \newcommand\tagpdfparaOn {}
 \newcommand\tagpdfparaOff{}
 %% File: tagpdf-roles.dtx
diff --git a/texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty b/texmf/tex/latex/tagpdf/tagpdf-debug-generic.sty
index 51804390..3bc33d41 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} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-debug-generic} {2023-12-18} {0.98r}
  {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-lua.sty b/texmf/tex/latex/tagpdf/tagpdf-debug-lua.sty
index e07859b9..96ef7382 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-debug-lua.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf-debug-lua.sty
@@ -19,7 +19,7 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf-mc-luacode.dtx
-\ProvidesExplPackage {tagpdf-debug-lua} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-debug-lua} {2023-12-18} {0.98r}
  {part of tagpdf - debugging code related to marking chunks - lua mode}
 \cs_set_protected:Npn \__tag_mc_handle_stash:n #1 %1 mcidnum
   {
diff --git a/texmf/tex/latex/tagpdf/tagpdf-debug.sty b/texmf/tex/latex/tagpdf/tagpdf-debug.sty
index 704c280a..e5f6ff92 100644
--- a/texmf/tex/latex/tagpdf/tagpdf-debug.sty
+++ b/texmf/tex/latex/tagpdf/tagpdf-debug.sty
@@ -26,12 +26,56 @@
 %% and all files in that bundle must be distributed together.
 %% 
 %% File: tagpdf.dtx
-\ProvidesExplPackage {tagpdf-debug} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-debug} {2023-12-18} {0.98r}
   { debug code for tagpdf }
 \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput}
 \prop_gput:Nnn \g_msg_module_type_prop { tag / debug} {}
 \prop_gput:Nnn \g_msg_module_name_prop { tag / debug }{tagpdf~DEBUG}
 
+\cs_set_protected:Npn \tag_stop:
+  {
+     \msg_note:nnx {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
+    \bool_set_false:N \l__tag_active_socket_bool
+    \__tag_stop_para_ints:
+  }
+\cs_set_protected:Npn \tag_start:
+  {
+    \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
+    \int_if_zero:nT { \l__tag_tag_stop_int }
+      {
+        \bool_set_true:N \l__tag_active_struct_bool
+        \bool_set_true:N \l__tag_active_mc_bool
+        \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 }
+  }
+\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}
+    \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
+    \bool_set_false:N \l__tag_active_socket_bool
+    \__tag_stop_para_ints:
+  }
+\cs_set_protected:Npn \tag_start:n #1
+  {
+    \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
+    \int_if_zero:nT { \l__tag_tag_stop_int }
+      {
+        \bool_set_true:N \l__tag_active_struct_bool
+        \bool_set_true:N \l__tag_active_mc_bool
+        \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}
+  }
 
 \bool_if:NTF \g__tag_mode_lua_bool
   {
@@ -92,7 +136,7 @@
  }
 \msg_new:nnn { tag / debug } {struct-begin}
   {
-    Struct~\tag_get:n{struct_num}~begin~#1~with~options:~\tl_to_str:n{#2}~[\msg_line_context:]
+    Struct~\tag_get:n{struct_num}~begin~#1~with~options:~\tl_to_str:n{#2}~\\[\msg_line_context:]
   }
 \msg_new:nnn { tag / debug } {struct-end}
   {
@@ -150,7 +194,22 @@
         }
      }
  }
-
+\msg_new:nnn { tag / debug } {tag-stop}
+  {
+    \int_if_zero:nTF
+      {#1}
+      {Tagging~stopped}
+      {Tagging~(not)~stopped~(already~inactive)}\\
+    level:~#1~==>~\int_eval:n{#1+1}\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:]
+  }
+\msg_new:nnn { tag / debug } {tag-start}
+  {
+    \int_if_zero:nTF
+      {#1}
+      {Tagging~restarted}
+      {Tagging~(not)~restarted}\\
+    level:~\int_eval:n{#1+1}~==>~#1\tl_if_empty:nF{#2}{,~label:~#2}~[\msg_line_context:]
+  }
 %% File: tagpdf-user.dtx
 
 
@@ -450,7 +509,7 @@
 
 \cs_set_protected:Npn \tag_struct_end:n #1
  {
-\__tag_debug_struct_end_check:n{#1}
+    \__tag_check_if_active_struct:T{\__tag_debug_struct_end_check:n{#1}}
    \tag_struct_end:
  }
 \cs_set_protected:Npn \tag_struct_use:n #1 %#1 is the label
diff --git a/texmf/tex/latex/tagpdf/tagpdf-luatex.def b/texmf/tex/latex/tagpdf/tagpdf-luatex.def
index 27ab3efa..e0e335e8 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} {2023-11-19} {0.98q}
+\ProvidesExplFile {tagpdf-luatex.def} {2023-12-18} {0.98r}
   {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 41fa6d93..b71722d3 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} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-12-18} {0.98r}
  {part of tagpdf - code related to marking chunks - generic mode}
 \tl_new:N \l__tag_mc_ref_abspage_tl
 
diff --git a/texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty b/texmf/tex/latex/tagpdf/tagpdf-mc-code-lua.sty
index fecf9d13..c903cc5a 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} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-12-18} {0.98r}
   {tagpdf - mc code only for the luamode }
 \hook_gput_code:nnn{begindocument}{tagpdf/mc}
   {
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def b/texmf/tex/latex/tagpdf/tagpdf-ns-latex-book.def
index 2cfc97e6..2f34c74c 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-12-18} {0.98r}
 %% {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 a2bf0928..3be6393b 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-12-18} {0.98r}
 %% {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 72ca9041..0fd9ab29 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-12-18} {0.98r}
 %% {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 f889ac23..ad406cf1 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-12-18} {0.98r}
 abs,abs,mathml,
 and,and,mathml,
 annotation,annotation,mathml,
diff --git a/texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def b/texmf/tex/latex/tagpdf/tagpdf-ns-pdf.def
index 48053b5d..9d1f4247 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-12-18} {0.98r}
 %%  {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 363b236e..931c0447 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-12-18} {0.98r}
 %%  {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 7cc24567..919421b4 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-12-18} {0.98r}
 ,,,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 da619a39..ae274038 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} {2023-11-19} {0.98q}
+%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-12-18} {0.98r}
 ,,,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 460ce786..f5394895 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.98q",       --TAGVERSION
-    date          = "2023-11-19", --TAGDATE
+    version       = "0.98r",       --TAGVERSION
+    date          = "2023-12-18", --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 26eb303b..c2018a1d 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} {2023-11-19} {0.98q}
+\ProvidesExplPackage {tagpdf} {2023-12-18} {0.98r}
   { A package to experiment with pdf tagging }
 
 \bool_if:nF
@@ -112,6 +112,7 @@
 \bool_set_true:N \l__tag_active_mc_bool
 \bool_new:N \l__tag_active_struct_bool
 \bool_set_true:N \l__tag_active_struct_bool
+\bool_new:N \l__tag_active_socket_bool
 \bool_new:N \g__tag_tagunmarked_bool
 \prg_generate_conditional_variant:Nnn \pdf_object_if_exist:n {e}{T,F,TF}
 \cs_generate_variant:Nn \pdf_object_ref:n {e}
@@ -177,49 +178,44 @@
 \cs_generate_variant:Nn \__tag_seq_new:N    { c }
 \cs_generate_variant:Nn \__tag_seq_show:N   { c }
 \cs_generate_variant:Nn \__tag_prop_show:N  { c }
-\cs_new_protected:Npn \tag_stop_group_begin:
-  {
-    \group_begin:
-    \bool_set_false:N \l__tag_active_struct_bool
-    \bool_set_false:N \l__tag_active_mc_bool
-    \__tag_stop_para_ints:
-  }
-\cs_set_eq:NN \tag_stop_group_end: \group_end:
+\int_new:N \l__tag_tag_stop_int
 \cs_set_protected:Npn \tag_stop:
   {
+    \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
+    \bool_set_false:N \l__tag_active_socket_bool
     \__tag_stop_para_ints:
   }
 \cs_set_protected:Npn \tag_start:
   {
-    \bool_set_true:N \l__tag_active_struct_bool
-    \bool_set_true:N \l__tag_active_mc_bool
-    \__tag_start_para_ints:
+    \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
+    \int_if_zero:nT { \l__tag_tag_stop_int }
+      {
+        \bool_set_true:N \l__tag_active_struct_bool
+        \bool_set_true:N \l__tag_active_mc_bool
+        \bool_set_true:N \l__tag_active_socket_bool
+        \__tag_start_para_ints:
+      }
   }
 \cs_set_eq:NN\tagstop\tag_stop:
 \cs_set_eq:NN\tagstart\tag_start:
-\prop_new:N\g__tag_state_prop
 \cs_set_protected:Npn \tag_stop:n #1
   {
-    \tag_if_active:TF
-      {
-        \bool_set_false:N \l__tag_active_struct_bool
-        \bool_set_false:N \l__tag_active_mc_bool
-        \__tag_stop_para_ints:
-        \prop_gput:Nnn \g__tag_state_prop { #1 }{ 1 }
-      }
-      {
-        \prop_gremove:Nn \g__tag_state_prop { #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
+    \bool_set_false:N \l__tag_active_socket_bool
+    \__tag_stop_para_ints:
   }
 \cs_set_protected:Npn \tag_start:n #1
   {
-    \prop_gpop:NnN \g__tag_state_prop {#1}\l__tag_tmpa_tl
-     \quark_if_no_value:NF \l__tag_tmpa_tl
+    \int_if_zero:nF { \l__tag_tag_stop_int } { \int_decr:N \l__tag_tag_stop_int }
+    \int_if_zero:nT { \l__tag_tag_stop_int }
       {
         \bool_set_true:N \l__tag_active_struct_bool
         \bool_set_true:N \l__tag_active_mc_bool
+        \bool_set_true:N \l__tag_active_socket_bool
         \__tag_start_para_ints:
       }
   }
@@ -620,12 +616,14 @@
  {
   \tag_mc_end_push:
   \tag_mc_begin:n {artifact=#1}
-  \tag_stop_group_begin:
+  \group_begin:
+  \tag_stop:n{artifact-group}
  }
 
 \cs_set_protected:Npn \tag_mc_artifact_group_end:
  {
-  \tag_stop_group_end:
+  \tag_start:n{artifact-group}
+  \group_end:
   \tag_mc_end:
   \tag_mc_begin_pop:n{}
  }
@@ -2333,25 +2331,28 @@
 \cs_generate_variant:Nn \pdffile_embed_stream:nnN {neN}
 \cs_new_protected:Npn \__tag_struct_add_inline_AF:nn #1 #2
  {
-   \group_begin:
-   \int_gincr:N \g__tag_struct_AFobj_int
-   \pdffile_embed_stream:neN
-     {#1}
-     {tag-AFfile\int_use:N\g__tag_struct_AFobj_int.#2}
-     \l__tag_tmpa_tl
-     \__tag_struct_add_AF:ee
-       { \int_use:N \c at g__tag_struct_abs_int }
-       { \l__tag_tmpa_tl }
-     \__tag_struct_prop_gput:nne
-       { \int_use:N \c at g__tag_struct_abs_int }
-       { AF }
-       {
-         [
-           \tl_use:c
-            { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_AF_tl }
-         ]
-       }
-   \group_end:
+   \tl_if_empty:nF{#1}
+     {
+      \group_begin:
+      \int_gincr:N \g__tag_struct_AFobj_int
+      \pdffile_embed_stream:neN
+        {#1}
+        {tag-AFfile\int_use:N\g__tag_struct_AFobj_int.#2}
+        \l__tag_tmpa_tl
+        \__tag_struct_add_AF:ee
+          { \int_use:N \c at g__tag_struct_abs_int }
+          { \l__tag_tmpa_tl }
+        \__tag_struct_prop_gput:nne
+          { \int_use:N \c at g__tag_struct_abs_int }
+          { AF }
+          {
+            [
+              \tl_use:c
+               { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_AF_tl }
+            ]
+          }
+      \group_end:
+     }
  }
 
 \cs_generate_variant:Nn \__tag_struct_add_inline_AF:nn {on}
@@ -2398,16 +2399,19 @@
       },
     AFref .code:n        = % AF property
       {
-        \__tag_struct_add_AF:ee { \int_use:N \c at g__tag_struct_abs_int }{#1}
-        \__tag_struct_prop_gput:nne
-          { \int_use:N \c at g__tag_struct_abs_int }
-          { AF }
-          {
-            [
-              \tl_use:c
-              { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_AF_tl }
-            ]
-          }
+        \tl_if_empty:eF {#1}
+         {
+           \__tag_struct_add_AF:ee { \int_use:N \c at g__tag_struct_abs_int }{#1}
+           \__tag_struct_prop_gput:nne
+             { \int_use:N \c at g__tag_struct_abs_int }
+             { AF }
+             {
+               [
+                 \tl_use:c
+                 { g__tag_struct_\int_eval:n {\c at g__tag_struct_abs_int}_AF_tl }
+               ]
+             }
+         }
       },
    ,AFinline .code:n =
      {
@@ -2420,6 +2424,7 @@
    ,texsource .code:n =
     {
       \group_begin:
+      \pdfdict_put:nnn { l_pdffile/Filespec } {Desc}{(TeX~source)}
       \pdfdict_put:nnn { l_pdffile/Filespec }{AFRelationship} { /Source }
       \__tag_struct_add_inline_AF:on {#1}{tex}
       \group_end:
@@ -2427,6 +2432,7 @@
    ,mathml .code:n =
      {
       \group_begin:
+      \pdfdict_put:nnn { l_pdffile/Filespec } {Desc}{(mathml~representation)}
       \pdfdict_put:nnn { l_pdffile/Filespec }{AFRelationship} { /Supplement }
       \__tag_struct_add_inline_AF:on {#1}{xml}
       \group_end:
@@ -2959,6 +2965,31 @@
   {
     \tag_mc_if_in:TF { #1 } { #2 }
   }
+\cs_set_protected:Npn \tag_socket_use:n #1
+  {
+    \bool_if:NT \l__tag_active_socket_bool
+      { \UseSocket {tagsupport/#1} }
+  }
+\cs_set_protected:Npn \tag_socket_use:nn #1#2
+  {
+    \bool_if:NT \l__tag_active_socket_bool
+       { \UseSocket {tagsupport/#1} {#2} }
+  }
+\cs_set_protected:Npn \UseTaggingSocket #1
+  {
+    \bool_if:NTF \l__tag_active_socket_bool
+      { \UseSocket{tagsupport/#1} }
+      {
+        \int_case:nnF
+            { \int_use:c { c__socket_tagsupport/#1_args_int } }
+            {
+              0 \prg_do_nothing:
+              1 \use_none:n
+              2 \use_none:nn
+            }
+            \ERRORusetaggingsocket
+      }
+  }
 \NewDocumentCommand\ShowTagging { m }
   {
     \keys_set:nn { __tag / show }{ #1}
@@ -3096,10 +3127,11 @@
 
 \keys_define:nn { __tag / setup}
  {
+   activate-socket .bool_set:N  = \l__tag_active_socket_bool,
    activate  .code:n =
     {
       \keys_set:nn { __tag / setup }
-        { activate-mc,activate-tree,activate-struct }
+        { activate-mc,activate-tree,activate-struct,activate-socket }
       \tl_gset:Nn\g__tag_root_default_tl {#1}
     },
    activate .default:n = Document
@@ -3107,14 +3139,12 @@
 
 \AddToHook{begindocument/before}
   {
-    \bool_lazy_all:nT
-      {
-        { \g__tag_active_struct_dest_bool }
-        { \g__tag_active_struct_bool }
-        { \cs_if_exist_p:N \pdf_activate_structure_destination: }
-      }
+    \bool_lazy_and:nnT
+      { \g__tag_active_struct_dest_bool }
+      { \g__tag_active_struct_bool }
       {
-        \tl_set:Nn \l_pdf_current_structure_destination_tl { __tag/struct/\g__tag_struct_stack_current_tl }
+        \tl_set:Nn \l_pdf_current_structure_destination_tl
+           { __tag/struct/\g__tag_struct_stack_current_tl }
         \pdf_activate_structure_destination:
       }
    }
@@ -3127,8 +3157,6 @@
      }
   }
 \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
 \int_new:N  \g__tag_para_end_int
 \int_new:N  \g__tag_para_main_begin_int





More information about the latex3-commits mailing list.