Skip to content

Commit

Permalink
Provide xtemplate based definitions for list environments
Browse files Browse the repository at this point in the history
And with this, we have tagging implemented entirely relying on the public API
for the purpose.
  • Loading branch information
gusbrs committed Oct 14, 2024
1 parent c1b3fca commit a8b15bd
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 24 deletions.
70 changes: 55 additions & 15 deletions postnotes.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -3109,25 +3109,65 @@
\socket_assign_plug:nn { tagsupport/postnotes/printtext/begin } { default }
\socket_assign_plug:nn { tagsupport/postnotes/printtext/end } { default }
% \end{macrocode}
% As far as I can tell, there is no (public) interface to control/tweak the
% default tagging of lists (see \url{https://tex.stackexchange.com/q/703083}).
% So I could only make things work by tampering with
% \pkg{latex-lab-testphase-block}'s internals.
% \begin{macrocode}
\cs_new:Npn \@@_tagsup_print_block_begin:
{ \tag_struct_begin:n { tag=L, attribute-class=EndnotesList } }
\AddToHook { postnotes/print/begin } [ postnotes/tagsup ]
% Provide \pkg{xtemplate} based redefinitions of \env{postnoteslist} and
% \pkg{postnoteslisthang}. This is needed because, as far as I can tell, it
% is the only way to set \opt{tag} and \opt{attribute-class} for the list
% struct without tampering with \pkg{latex-lab-testphase-block}'s internals.
% \begin{macrocode}
\DeclareInstance { blockenv } { postnoteslist } { display }
{
env-name = postnoteslist ,
tag-name = L ,
tag-class = EndnotesList ,
tagging-recipe = list ,
inner-level-counter = ,
level-increase = true ,
setup-code = ,
block-instance = list ,
inner-instance = postnoteslist ,
}
\DeclareInstanceCopy { blockenv } { postnoteslisthang } { postnoteslist }
\EditInstance { blockenv } { postnoteslisthang }
{ env-name = postnoteslisthang }
\DeclareInstance { list } { postnoteslist } { std }
{ item-instance = postnoteslist }
\DeclareInstance { item } { postnoteslist } { std }
{
label-format = { \hspace { \labelsep } \normalfont ~ #1 } ,
label-align = left ,
}
\RenewDocumentEnvironment { postnoteslist } { }
{
\UseInstance { blockenv } { postnoteslist }
{
leftmargin = 0pt ,
label-width = 0pt ,
item-indent = .5\parindent ,
rightmargin = 0pt ,
parindent = \parindent ,
par-skip = \parskip ,
item-skip = 0pt ,
beginsep = .5\topsep ,
begin-par-skip = .5\partopsep ,
}
}
{ \endblockenv }
\RenewDocumentEnvironment { postnoteslisthang } { }
{
\bool_if:NT \l_@@_print_as_list_bool
\UseInstance { blockenv } { postnoteslisthang }
{
\exp_args:Ne \AddToHookNext
{ env / \l_@@_print_env_tl / begin }
{
\cs_set_eq:NN \__block_list_begin:
\@@_tagsup_print_block_begin:
}
leftmargin = 1em ,
label-width = -\leftmargin ,
item-indent = -2\leftmargin ,
rightmargin = 0pt ,
parindent = \parindent ,
par-skip = \parskip ,
item-skip = 0pt ,
beginsep = .5\topsep ,
begin-par-skip = .5\partopsep ,
}
}
{ \endblockenv }
% \end{macrocode}
% Setup for \cs{label} and \cs{zlabel} inside the note.
% \begin{macrocode}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup01.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup01.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup01.xetex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup02.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'L' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup02.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'L' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup02.xetex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'Sect' --> 'L' on line ...
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 35 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup04.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup04.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down
2 changes: 1 addition & 1 deletion testfiles-4runs/pn-tagsup04.xetex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ The sequence \g__tag_struct_tag_stack_seq contains the items (without outer brac
Package tagpdf Info: Parent-Child 'Sect' --> 'L'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from 'Sect/pdf2' --> 'L/pdf2' on line ...
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=L,attribute-class=EndnotesList
tagpdf DEBUG Info: Struct 18 begin inserted with options: tag=\l__tag_L_tag_tl ,attribute-class=\l__tag_L_attr_class_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{L}{L}}
Expand Down

0 comments on commit a8b15bd

Please sign in to comment.