[latex3-commits] [latex3/tagpdf] develop: add support for language settings (bec4865)
github at latex-project.org
github at latex-project.org
Mon Mar 25 22:34:23 CET 2024
Repository : https://github.com/latex3/tagpdf
On branch : develop
Link : https://github.com/latex3/tagpdf/commit/bec4865990c2f7d2b5dec4bdbf1a5d2db9bc5210
>---------------------------------------------------------------
commit bec4865990c2f7d2b5dec4bdbf1a5d2db9bc5210
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Mar 25 22:34:23 2024 +0100
add support for language settings
>---------------------------------------------------------------
bec4865990c2f7d2b5dec4bdbf1a5d2db9bc5210
CHANGELOG.md | 1 +
doc/tagpdf.tex | 3 +-
doc/tagpdfsetup-keys.tex | 4 +-
tagpdf-struct.dtx | 20 ++-
tagpdf-user.dtx | 14 ++-
testfiles-luatex/debug-structures-2.tlg | 16 +--
testfiles-luatex/debug-structures.tlg | 16 +--
testfiles-pdftex/debug-structures-2.pdftexmain.tlg | 18 +--
testfiles-pdftex/debug-structures-2.tlg | 18 +--
testfiles-pdftex/debug-structures.pdftexmain.tlg | 18 +--
testfiles-pdftex/debug-structures.tlg | 18 +--
testfiles-pdftex/para-main-struct.tlg | 10 +-
testfiles/test-lang-change.lvt | 21 ++++
testfiles/test-lang-change.tlg | 138 +++++++++++++++++++++
14 files changed, 254 insertions(+), 61 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 696488d..bb9b7f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
### Added
- statistic and benchmark at the end of the run.
+ - text/lang key to change the language of structures.
### Changed
- speed up writing of StructElems
diff --git a/doc/tagpdf.tex b/doc/tagpdf.tex
index 10d218a..5b591bb 100644
--- a/doc/tagpdf.tex
+++ b/doc/tagpdf.tex
@@ -1859,7 +1859,8 @@ The key-val list understands the following keys:
\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
diff --git a/doc/tagpdfsetup-keys.tex b/doc/tagpdfsetup-keys.tex
index 2c255fb..66ff2c2 100644
--- a/doc/tagpdfsetup-keys.tex
+++ b/doc/tagpdfsetup-keys.tex
@@ -66,6 +66,8 @@ math/tex/AF & --- &boolean &bool &latex-lab-math\\[4p
%% 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}
diff --git a/tagpdf-struct.dtx b/tagpdf-struct.dtx
index 0cf8eec..90eb25f 100644
--- a/tagpdf-struct.dtx
+++ b/tagpdf-struct.dtx
@@ -1425,10 +1425,16 @@
}
},
}
-%</package>
% \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}
%
% \begin{macro}{\tag_struct_begin:n,\tag_struct_end:}
% \begin{macrocode}
@@ -1456,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}
diff --git a/tagpdf-user.dtx b/tagpdf-user.dtx
index 5c74dc2..60117b9 100644
--- a/tagpdf-user.dtx
+++ b/tagpdf-user.dtx
@@ -763,7 +763,7 @@
% this will hold the structure number of the current text-unit.
% \begin{macrocode}
\tl_new:N \g_@@_para_main_struct_tl
-\tl_set:Nn \g_@@_para_main_struct_tl {1}
+\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
@@ -1198,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.
diff --git a/testfiles-luatex/debug-structures-2.tlg b/testfiles-luatex/debug-structures-2.tlg
index 21145e2..bb86e57 100644
--- a/testfiles-luatex/debug-structures-2.tlg
+++ b/testfiles-luatex/debug-structures-2.tlg
@@ -32,7 +32,7 @@ The structure 1 contains:
> NS => pdf2
> rolemap => {Document}{pdf2}
> parentrole => {Document}{pdf2}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
The structure has the following kids:
> Struct 4
=========================
@@ -65,7 +65,7 @@ The structure 4 contains:
> NS => pdf2
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
The structure has the following kids:
> Struct 5
> Struct 7
@@ -79,7 +79,7 @@ The structure 5 contains:
> NS => latex
> rolemap => {H1}{pdf2}
> parentrole => {H1}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 6
> MC 3
@@ -91,7 +91,7 @@ The structure 6 contains:
> NS => pdf2
> rolemap => {Lbl}{pdf2}
> parentrole => {Lbl}{pdf2}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
The structure has the following kids:
> MC 1
> MC 2
@@ -103,7 +103,7 @@ The structure 7 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 8
=========================
@@ -115,7 +115,7 @@ The structure 8 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
The structure has the following kids:
> MC 4
> Struct 9
@@ -151,7 +151,7 @@ The structure 11 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 12
=========================
@@ -163,7 +163,7 @@ The structure 12 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
The structure has the following kids:
> MC 7
=========================
diff --git a/testfiles-luatex/debug-structures.tlg b/testfiles-luatex/debug-structures.tlg
index 223bae7..234231a 100644
--- a/testfiles-luatex/debug-structures.tlg
+++ b/testfiles-luatex/debug-structures.tlg
@@ -31,7 +31,7 @@ The structure 1 contains:
> S => /Document
> rolemap => {Document}{}
> parentrole => {Document}{}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
> NS => pdf2
The structure has the following kids:
> Struct 4
@@ -64,7 +64,7 @@ The structure 4 contains:
> S => /Sect
> rolemap => {Sect}{}
> parentrole => {Sect}{}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
> NS => pdf2
The structure has the following kids:
> Struct 5
@@ -78,7 +78,7 @@ The structure 5 contains:
> S => /section
> rolemap => {H1}{}
> parentrole => {H1}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 6
@@ -90,7 +90,7 @@ The structure 6 contains:
> S => /Lbl
> rolemap => {Lbl}{}
> parentrole => {Lbl}{}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
> NS => pdf2
The structure has the following kids:
> MC 1
@@ -102,7 +102,7 @@ The structure 7 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 8
@@ -114,7 +114,7 @@ The structure 8 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
> NS => user
The structure has the following kids:
> MC 4
@@ -150,7 +150,7 @@ The structure 11 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 12
@@ -162,7 +162,7 @@ The structure 12 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
> NS => user
The structure has the following kids:
> MC 7
diff --git a/testfiles-pdftex/debug-structures-2.pdftexmain.tlg b/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
index ea5a7cc..c81c72e 100644
--- a/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
+++ b/testfiles-pdftex/debug-structures-2.pdftexmain.tlg
@@ -30,7 +30,7 @@ The structure 1 contains:
> NS => pdf2
> rolemap => {Document}{pdf2}
> parentrole => {Document}{pdf2}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
The structure has the following kids:
> Struct 4
=========================
@@ -63,7 +63,7 @@ The structure 4 contains:
> NS => pdf2
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
The structure has the following kids:
> Struct 5
> Struct 7
@@ -77,7 +77,7 @@ The structure 5 contains:
> NS => latex
> rolemap => {H1}{pdf2}
> parentrole => {H1}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 6
> MC 2
@@ -89,7 +89,7 @@ The structure 6 contains:
> NS => pdf2
> rolemap => {Lbl}{pdf2}
> parentrole => {Lbl}{pdf2}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
The structure has the following kids:
> MC 1
=========================
@@ -100,7 +100,7 @@ The structure 7 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 8
=========================
@@ -112,7 +112,7 @@ The structure 8 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
The structure has the following kids:
> MC 3
> Struct 9
@@ -125,7 +125,7 @@ The structure 9 contains:
> NS => pdf2
> rolemap => {Link}{pdf2}
> parentrole => {Link}{pdf2}
-> P => parent structure: 8 = P
+> P => parent structure: 8 = /text
The structure has the following kids:
> MC 4
> OBJR reference
@@ -148,7 +148,7 @@ The structure 11 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 12
=========================
@@ -160,7 +160,7 @@ The structure 12 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
The structure has the following kids:
> MC 6
=========================
diff --git a/testfiles-pdftex/debug-structures-2.tlg b/testfiles-pdftex/debug-structures-2.tlg
index ea5a7cc..c81c72e 100644
--- a/testfiles-pdftex/debug-structures-2.tlg
+++ b/testfiles-pdftex/debug-structures-2.tlg
@@ -30,7 +30,7 @@ The structure 1 contains:
> NS => pdf2
> rolemap => {Document}{pdf2}
> parentrole => {Document}{pdf2}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
The structure has the following kids:
> Struct 4
=========================
@@ -63,7 +63,7 @@ The structure 4 contains:
> NS => pdf2
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
The structure has the following kids:
> Struct 5
> Struct 7
@@ -77,7 +77,7 @@ The structure 5 contains:
> NS => latex
> rolemap => {H1}{pdf2}
> parentrole => {H1}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 6
> MC 2
@@ -89,7 +89,7 @@ The structure 6 contains:
> NS => pdf2
> rolemap => {Lbl}{pdf2}
> parentrole => {Lbl}{pdf2}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
The structure has the following kids:
> MC 1
=========================
@@ -100,7 +100,7 @@ The structure 7 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 8
=========================
@@ -112,7 +112,7 @@ The structure 8 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
The structure has the following kids:
> MC 3
> Struct 9
@@ -125,7 +125,7 @@ The structure 9 contains:
> NS => pdf2
> rolemap => {Link}{pdf2}
> parentrole => {Link}{pdf2}
-> P => parent structure: 8 = P
+> P => parent structure: 8 = /text
The structure has the following kids:
> MC 4
> OBJR reference
@@ -148,7 +148,7 @@ The structure 11 contains:
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
The structure has the following kids:
> Struct 12
=========================
@@ -160,7 +160,7 @@ The structure 12 contains:
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
The structure has the following kids:
> MC 6
=========================
diff --git a/testfiles-pdftex/debug-structures.pdftexmain.tlg b/testfiles-pdftex/debug-structures.pdftexmain.tlg
index 62300f4..ecfb2cd 100644
--- a/testfiles-pdftex/debug-structures.pdftexmain.tlg
+++ b/testfiles-pdftex/debug-structures.pdftexmain.tlg
@@ -29,7 +29,7 @@ The structure 1 contains:
> S => /Document
> rolemap => {Document}{}
> parentrole => {Document}{}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
> NS => pdf2
The structure has the following kids:
> Struct 4
@@ -62,7 +62,7 @@ The structure 4 contains:
> S => /Sect
> rolemap => {Sect}{}
> parentrole => {Sect}{}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
> NS => pdf2
The structure has the following kids:
> Struct 5
@@ -76,7 +76,7 @@ The structure 5 contains:
> S => /section
> rolemap => {H1}{}
> parentrole => {H1}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 6
@@ -88,7 +88,7 @@ The structure 6 contains:
> S => /Lbl
> rolemap => {Lbl}{}
> parentrole => {Lbl}{}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
> NS => pdf2
The structure has the following kids:
> MC 1
@@ -99,7 +99,7 @@ The structure 7 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 8
@@ -111,7 +111,7 @@ The structure 8 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
> NS => user
The structure has the following kids:
> MC 3
@@ -124,7 +124,7 @@ The structure 9 contains:
> S => /Link
> rolemap => {Link}{}
> parentrole => {Link}{}
-> P => parent structure: 8 = P
+> P => parent structure: 8 = /text
> NS => pdf2
The structure has the following kids:
> MC 4
@@ -147,7 +147,7 @@ The structure 11 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 12
@@ -159,7 +159,7 @@ The structure 12 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
> NS => user
The structure has the following kids:
> MC 6
diff --git a/testfiles-pdftex/debug-structures.tlg b/testfiles-pdftex/debug-structures.tlg
index 62300f4..ecfb2cd 100644
--- a/testfiles-pdftex/debug-structures.tlg
+++ b/testfiles-pdftex/debug-structures.tlg
@@ -29,7 +29,7 @@ The structure 1 contains:
> S => /Document
> rolemap => {Document}{}
> parentrole => {Document}{}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
> NS => pdf2
The structure has the following kids:
> Struct 4
@@ -62,7 +62,7 @@ The structure 4 contains:
> S => /Sect
> rolemap => {Sect}{}
> parentrole => {Sect}{}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
> NS => pdf2
The structure has the following kids:
> Struct 5
@@ -76,7 +76,7 @@ The structure 5 contains:
> S => /section
> rolemap => {H1}{}
> parentrole => {H1}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 6
@@ -88,7 +88,7 @@ The structure 6 contains:
> S => /Lbl
> rolemap => {Lbl}{}
> parentrole => {Lbl}{}
-> P => parent structure: 5 = H1
+> P => parent structure: 5 = /section
> NS => pdf2
The structure has the following kids:
> MC 1
@@ -99,7 +99,7 @@ The structure 7 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 8
@@ -111,7 +111,7 @@ The structure 8 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 7 = Sect
+> P => parent structure: 7 = /text-unit
> NS => user
The structure has the following kids:
> MC 3
@@ -124,7 +124,7 @@ The structure 9 contains:
> S => /Link
> rolemap => {Link}{}
> parentrole => {Link}{}
-> P => parent structure: 8 = P
+> P => parent structure: 8 = /text
> NS => pdf2
The structure has the following kids:
> MC 4
@@ -147,7 +147,7 @@ The structure 11 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Sect}{}
-> P => parent structure: 4 = Sect
+> P => parent structure: 4 = /Sect
> NS => user
The structure has the following kids:
> Struct 12
@@ -159,7 +159,7 @@ The structure 12 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 11 = Sect
+> P => parent structure: 11 = /text-unit
> NS => user
The structure has the following kids:
> MC 6
diff --git a/testfiles-pdftex/para-main-struct.tlg b/testfiles-pdftex/para-main-struct.tlg
index 8df3594..d99f63a 100644
--- a/testfiles-pdftex/para-main-struct.tlg
+++ b/testfiles-pdftex/para-main-struct.tlg
@@ -21,7 +21,7 @@ The structure 1 contains:
> S => /Document
> rolemap => {Document}{}
> parentrole => {Document}{}
-> P => parent structure: 0 = StructTreeRoot
+> P => parent structure: 0 = /StructTreeRoot
> NS => pdf2
The structure has the following kids:
> Struct 4
@@ -55,7 +55,7 @@ The structure 4 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Document}{}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
> NS => user
The structure has the following kids:
> Struct 5
@@ -67,7 +67,7 @@ The structure 5 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 4 = Document
+> P => parent structure: 4 = /text-unit
> NS => user
The structure has the following kids:
> MC 1
@@ -78,7 +78,7 @@ The structure 6 contains:
> S => /text-unit
> rolemap => {Part}{}
> parentrole => {Document}{}
-> P => parent structure: 1 = Document
+> P => parent structure: 1 = /Document
> NS => user
The structure has the following kids:
> Struct 7
@@ -90,7 +90,7 @@ The structure 7 contains:
> S => /text
> rolemap => {P}{}
> parentrole => {P}{}
-> P => parent structure: 6 = Document
+> P => parent structure: 6 = /text-unit
> NS => user
The structure has the following kids:
> MC 2
diff --git a/testfiles/test-lang-change.lvt b/testfiles/test-lang-change.lvt
new file mode 100644
index 0000000..59501b7
--- /dev/null
+++ b/testfiles/test-lang-change.lvt
@@ -0,0 +1,21 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation }
+\msg_redirect_module:nnn { pdf } { none } { warning }
+\ExplSyntaxOff
+\DocumentMetadata{testphase=phase-III}
+\input{regression-test}
+\documentclass{article}
+\usepackage[ngerman,english]{babel}
+\usepackage{tagpdf-debug}
+\AddToHookWithArguments{env/otherlanguage/begin}{\tagpdfsetup{text/lang=\BCPdata{language}}}
+\begin{document}
+\START
+english
+
+\begin{otherlanguage}{german}
+deutsch\end{otherlanguage}
+
+english
+\ShowTagging{debug/structures}
+\end{document}
diff --git a/testfiles/test-lang-change.tlg b/testfiles/test-lang-change.tlg
new file mode 100644
index 0000000..b3ffbec
--- /dev/null
+++ b/testfiles/test-lang-change.tlg
@@ -0,0 +1,138 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+=========================
+The structure 0 contains:
+> Type => /StructTreeRoot
+> S => /StructTreeRoot
+> rolemap => {StructTreeRoot}{pdf}
+> parentrole => {StructTreeRoot}{pdf}
+The structure has the following kids:
+> Struct 1
+=========================
+=========================
+The structure 1 contains:
+> Type => /StructElem
+> S => /Document
+> rolemap => {Document}{}
+> parentrole => {Document}{}
+> P => parent structure: 0 = /StructTreeRoot
+> NS => pdf2
+The structure has the following kids:
+> Struct 4
+> Struct 6
+> Struct 8
+=========================
+=========================
+The structure 2 contains:
+> Type => /StructElem
+> S => /figures
+> rolemap => {Sect}{}
+> parentrole => {Sect}{}
+> P => no parent: stashed
+> NS => user
+The structure has the following kids:
+> NONE
+=========================
+=========================
+The structure 3 contains:
+> Type => /StructElem
+> S => /tables
+> rolemap => {Sect}{}
+> parentrole => {Sect}{}
+> P => no parent: stashed
+> NS => user
+The structure has the following kids:
+> NONE
+=========================
+=========================
+The structure 4 contains:
+> Type => /StructElem
+> S => /text-unit
+> rolemap => {Part}{}
+> parentrole => {Document}{}
+> P => parent structure: 1 = /Document
+> NS => user
+The structure has the following kids:
+> Struct 5
+=========================
+=========================
+The structure 5 contains:
+> Type => /StructElem
+> C => /justify
+> S => /text
+> rolemap => {P}{}
+> parentrole => {P}{}
+> P => parent structure: 4 = /text-unit
+> NS => user
+The structure has the following kids:
+> MC 1
+=========================
+=========================
+The structure 6 contains:
+> Type => /StructElem
+> Lang => (de)
+> S => /text-unit
+> rolemap => {Part}{}
+> parentrole => {Document}{}
+> P => parent structure: 1 = /Document
+> NS => user
+The structure has the following kids:
+> Struct 7
+=========================
+=========================
+The structure 7 contains:
+> Type => /StructElem
+> Lang => (de)
+> C => /justify
+> S => /text
+> rolemap => {P}{}
+> parentrole => {P}{}
+> P => parent structure: 6 = /text-unit
+> NS => user
+The structure has the following kids:
+> MC 2
+=========================
+=========================
+The structure 8 contains:
+> Type => /StructElem
+> S => /text-unit
+> rolemap => {Part}{}
+> parentrole => {Document}{}
+> P => parent structure: 1 = /Document
+> NS => user
+The structure has the following kids:
+> Struct 9
+=========================
+=========================
+The structure 9 contains:
+> Type => /StructElem
+> C => /justify
+> S => /text
+> rolemap => {P}{}
+> parentrole => {P}{}
+> P => parent structure: 8 = /text-unit
+> NS => user
+The structure has the following kids:
+> MC 3
+=========================
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging stopped
+(tagpdf DEBUG) level: 0 ==> 1, label: headfoot [on line ...]
+tagpdf DEBUG Info: Tagging restarted
+(tagpdf DEBUG) level: 1 ==> 0, label: headfoot [on line ...]
+[1
+] (test-lang-change.aux)
+Package tagpdf Info: Finalizing the tagging structure:
+(tagpdf) Writing out ~9 structure objects
+(tagpdf) with ~5 'MC' leaf nodes.
+(tagpdf) Be patient if there are lots of objects!
+Package tagpdf Info: writing ParentTree
+Package tagpdf Info: writing IDTree
+Package tagpdf Info: writing RoleMap
+Package tagpdf Info: writing ClassMap
+Package tagpdf Info: writing NameSpaces
+Package tagpdf Info: writing StructElems
+Package tagpdf Info: writing Root
More information about the latex3-commits
mailing list.