Skip to content

Commit

Permalink
add tests for debug/structure
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Aug 30, 2023
1 parent 6cf679a commit 8cca9d5
Show file tree
Hide file tree
Showing 9 changed files with 675 additions and 5 deletions.
Binary file modified experiments/debug-show.pdf
Binary file not shown.
8 changes: 6 additions & 2 deletions experiments/debug-show.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\DocumentMetadata{testphase=phase-III}
\RequirePackage{tagpdf-debug}
\DocumentMetadata{testphase=phase-III,pdfversion=2.0}
\RequirePackage{tagpdf-debug}
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Expand All @@ -8,6 +8,10 @@
\section{blub}\label{a}
blub\ref{a}

\tagstructbegin{stash,label=blub,tag=Span}\tagstructend

\tagstructuse{blub} xxx

\AddToHook{tagpdf/finish/before}{\ShowTagging{debug/structures}}
%\ExplSyntaxOn\makeatletter
%
Expand Down
14 changes: 11 additions & 3 deletions tagpdf-struct.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@
{ \l_@@_get_tmpc_tl } %
}
}
}
}
\cs_generate_variant:Nn \@@_struct_set_tag_info:nnn {eVV}
% \end{macrocode}
% \end{macro}
Expand Down Expand Up @@ -1515,10 +1515,14 @@
%<debug> \bool_if:NTF \l_@@_struct_elem_stash_bool
%<debug> {no~parent:~stashed}
%<debug> {
%<debug> parent~structure~\l_@@_struct_stack_parent_tmpa_tl\c_space_tl =~
%<debug> parent~structure:~\l_@@_struct_stack_parent_tmpa_tl\c_space_tl =~
%<debug> \l_@@_get_parent_tmpa_tl
%<debug> }
%<debug> }
%<debug> \prop_gput:cnx
%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
%<debug> { NS }
%<debug> { \g_@@_struct_tag_NS_tl }
% \end{macrocode}
% \begin{macrocode}
%\prop_show:c { g_@@_struct_\g_@@_struct_stack_current_tl _prop }
Expand Down Expand Up @@ -1607,9 +1611,13 @@
%<debug> { g_@@_struct_debug_\@@_ref_value:enn{tagpdfstruct-#1}{tagstruct}{0}_prop }
%<debug> { P }
%<debug> {
%<debug> parent structure~\l_@@_struct_stack_parent_tmpa_tl\c_space_tl=~
%<debug> parent~structure:~\g_@@_struct_stack_current_tl\c_space_tl=~
%<debug> \g_@@_struct_tag_tl
%<debug> }
%<debug> \prop_gput:cnx
%<debug> { g_@@_struct_debug_\int_eval:n {\c@g_@@_struct_abs_int}_prop }
%<debug> { NS }
%<debug> { \g_@@_struct_tag_NS_tl }
% \end{macrocode}
% check if the tag is allowed as child. Here we have to retrieve the
% tag info for the child, while the data for the parent is in
Expand Down
157 changes: 157 additions & 0 deletions testfiles/debug-structures-2.luatex.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
Package tagpdf Warning: structure with label blub has already been used
[1
] (debug-structures-2.aux)
=========================
The structure 0 contains:
> Type => /StructTreeRoot
> S => /StructTreeRoot
> rolemap => {StructTreeRoot}{pdf}
> parentrole => {StructTreeRoot}{pdf}
> Namespaces => 7 0 R
The structure has the following kids:
> Struct 1
=========================
=========================
The structure 1 contains:
> Type => /StructElem
> S => /Document
> NS => pdf2
> rolemap => {Document}{pdf2}
> parentrole => {Document}{pdf2}
> P => parent structure 0 = StructTreeRoot
The structure has the following kids:
> Struct 4
=========================
=========================
The structure 2 contains:
> Type => /StructElem
> S => /figures
> NS => user
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => no parent: stashed
The structure has the following kids:
> NONE
=========================
=========================
The structure 3 contains:
> Type => /StructElem
> S => /tables
> NS => user
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => no parent: stashed
The structure has the following kids:
> NONE
=========================
=========================
The structure 4 contains:
> Type => /StructElem
> S => /Sect
> NS => pdf2
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 1 = Document
The structure has the following kids:
> Struct 5
> Struct 7
> Struct 9
> Struct 11
=========================
=========================
The structure 5 contains:
> Type => /StructElem
> S => /section
> NS => latex
> rolemap => {H1}{pdf2}
> parentrole => {H1}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 6
> MC 3
=========================
=========================
The structure 6 contains:
> Type => /StructElem
> S => /Lbl
> NS => pdf2
> rolemap => {Lbl}{pdf2}
> parentrole => {Lbl}{pdf2}
> P => parent structure 5 = H1
The structure has the following kids:
> MC 1
> MC 2
=========================
=========================
The structure 7 contains:
> Type => /StructElem
> S => /text-unit
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 8
=========================
=========================
The structure 8 contains:
> Type => /StructElem
> C => /justify
> S => /text
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
> P => parent structure 7 = Sect
The structure has the following kids:
> MC 4
> Struct 9
> MC 6
=========================
=========================
The structure 9 contains:
> Type => /StructElem
> S => /Link
> NS => 10 0 R
> rolemap => {Link}{pdf2}
> parentrole => {Link}{pdf2}
> P => parentstructure 4 = Sect
The structure has the following kids:
> MC 5
> OBJR reference
=========================
=========================
The structure 10 contains:
> Type => /StructElem
> S => /Span
> NS => pdf2
> rolemap => {Span}{pdf2}
> parentrole => {Span}{pdf2}
> P => no parent: stashed
The structure has the following kids:
> NONE
=========================
=========================
The structure 11 contains:
> Type => /StructElem
> S => /text-unit
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 12
=========================
=========================
The structure 12 contains:
> Type => /StructElem
> C => /justify
> S => /text
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
> P => parent structure 11 = Sect
The structure has the following kids:
> MC 7
=========================
18 changes: 18 additions & 0 deletions testfiles/debug-structures-2.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\DocumentMetadata{testphase=phase-III,pdfversion=2.0}
\input{regression-test}

\RequirePackage{tagpdf-debug}
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\START

\section{blub}\label{a}
blub\ref{a}

\tagstructbegin{stash,label=blub,tag=Span}\tagstructend

\tagstructuse{blub} xxx

\AddToHook{tagpdf/finish/before}{\ShowTagging{debug/structures}}
\end{document}
155 changes: 155 additions & 0 deletions testfiles/debug-structures-2.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
[1
] (debug-structures-2.aux)
=========================
The structure 0 contains:
> Type => /StructTreeRoot
> S => /StructTreeRoot
> rolemap => {StructTreeRoot}{pdf}
> parentrole => {StructTreeRoot}{pdf}
> Namespaces => 7 0 R
The structure has the following kids:
> Struct 1
=========================
=========================
The structure 1 contains:
> Type => /StructElem
> S => /Document
> NS => pdf2
> rolemap => {Document}{pdf2}
> parentrole => {Document}{pdf2}
> P => parent structure 0 = StructTreeRoot
The structure has the following kids:
> Struct 4
=========================
=========================
The structure 2 contains:
> Type => /StructElem
> S => /figures
> NS => user
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => no parent: stashed
The structure has the following kids:
> NONE
=========================
=========================
The structure 3 contains:
> Type => /StructElem
> S => /tables
> NS => user
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => no parent: stashed
The structure has the following kids:
> NONE
=========================
=========================
The structure 4 contains:
> Type => /StructElem
> S => /Sect
> NS => pdf2
> rolemap => {Sect}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 1 = Document
The structure has the following kids:
> Struct 5
> Struct 7
> Struct 10
> Struct 11
=========================
=========================
The structure 5 contains:
> Type => /StructElem
> S => /section
> NS => latex
> rolemap => {H1}{pdf2}
> parentrole => {H1}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 6
> MC 2
=========================
=========================
The structure 6 contains:
> Type => /StructElem
> S => /Lbl
> NS => pdf2
> rolemap => {Lbl}{pdf2}
> parentrole => {Lbl}{pdf2}
> P => parent structure 5 = H1
The structure has the following kids:
> MC 1
=========================
=========================
The structure 7 contains:
> Type => /StructElem
> S => /text-unit
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 8
=========================
=========================
The structure 8 contains:
> Type => /StructElem
> C => /justify
> S => /text
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
> P => parent structure 7 = Sect
The structure has the following kids:
> MC 3
> Struct 9
> MC 5
=========================
=========================
The structure 9 contains:
> Type => /StructElem
> S => /Link
> NS => pdf2
> rolemap => {Link}{pdf2}
> parentrole => {Link}{pdf2}
> P => parent structure 8 = P
The structure has the following kids:
> MC 4
> OBJR reference
=========================
=========================
The structure 10 contains:
> Type => /StructElem
> S => /Span
> NS => pdf2
> rolemap => {Span}{pdf2}
> parentrole => {Span}{pdf2}
> P => parentstructure 4 = Sect
The structure has the following kids:
> NONE
=========================
=========================
The structure 11 contains:
> Type => /StructElem
> S => /text-unit
> NS => latex
> rolemap => {Part}{pdf2}
> parentrole => {Sect}{pdf2}
> P => parent structure 4 = Sect
The structure has the following kids:
> Struct 12
=========================
=========================
The structure 12 contains:
> Type => /StructElem
> C => /justify
> S => /text
> NS => latex
> rolemap => {P}{pdf2}
> parentrole => {P}{pdf2}
> P => parent structure 11 = Sect
The structure has the following kids:
> MC 6
=========================
Loading

0 comments on commit 8cca9d5

Please sign in to comment.