[latex3-commits] [latex3/latex2e] tagging705-float: use sockets for caption, WIP (0656b865)
github at latex-project.org
github at latex-project.org
Tue Sep 17 16:51:46 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : tagging705-float
Link : https://github.com/latex3/latex2e/commit/0656b865e18d545bb1b83364dcf25db00afb637b
>---------------------------------------------------------------
commit 0656b865e18d545bb1b83364dcf25db00afb637b
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Tue Sep 17 16:51:46 2024 +0200
use sockets for caption, WIP
>---------------------------------------------------------------
0656b865e18d545bb1b83364dcf25db00afb637b
base/lttagging.dtx | 7 ++
required/latex-lab/latex-lab-float.dtx | 115 ++++++++++++++-------
.../testfiles-float/float-010-outside.luatex.tlg | 7 +-
.../testfiles-float/float-010-outside.tlg | 7 +-
4 files changed, 89 insertions(+), 47 deletions(-)
diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 445c6d8a..2b4d2b26 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -261,6 +261,13 @@
\ExplSyntaxOff
% \end{macrocode}
% \end{plugdecl}
+%
+% \begin{socketdecl}{tagsupport/para/begin,tagsupport/para/end}
+% These sockets are currently defined in tagpdf. They overwrite
+% definitions in the latex-lab-block code. There is also a simpler
+% definition that probably should be a general socket too.
+% TODO: move this into lttagging.
+% \end{socketdecl}
% \subsubsection{Tagging sockets for toc}
diff --git a/required/latex-lab/latex-lab-float.dtx b/required/latex-lab/latex-lab-float.dtx
index 442bc7c7..2a24f6f5 100644
--- a/required/latex-lab/latex-lab-float.dtx
+++ b/required/latex-lab/latex-lab-float.dtx
@@ -44,6 +44,8 @@
%
% \providecommand\hook[1]{\texttt{#1}}
% \ProvideDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
+% \ProvideDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
+%
% \begin{documentation}
% \begin{abstract}
% The following code implements a first draft for the tagging of float
@@ -529,38 +531,56 @@
% \end{macrocode}
%
% \subsubsection{(Tagging} sockets}
+%
+% First some temporary sockets.
+% These sockets are in lttagging.
% \begin{macrocode}
\str_if_exist:cF { l__socket_tagsupport/caption/begin_plug_str }
{
\NewSocket{tagsupport/caption/begin}{1}
- \NewSocket{tagsupport/caption/end}
- \NewSocket{tagsupport/caption/singleline}{2}
- \NewSocket{tagsupport/caption/Lbl/end}
+ \NewSocket{tagsupport/caption/end}{0}
+ \NewSocket{tagsupport/caption/label/begin}{0}
+ \NewSocket{tagsupport/caption/label/end}{0}
+ }
+% \end{macrocode}
+% These socket is currently defined in tagpdf.
+% \begin{macrocode}
+\str_if_exist:cF { l__socket_tagsupport/para/begin_plug_str }
+ {
+ \NewSocket{tagsupport/para/begin}
+ \NewSocket{tagsupport/para/end}
+ }
+% \end{macrocode}
+%
+% This socket is for formatting the label.
+% \begin{socketdecl}{caption/label}
+% \begin{macrocode}
+\NewSocket{caption/label}{1}
+% \end{macrocode}
+% \end{socketdecl}
+%
+% \begin{plugdecl}{default (caption/label)}
+% \begin{macrocode}
+\NewSocketPlug{caption/label}{default}
+ {
+ #1:~
}
% \end{macrocode}
+% \end{plugdecl}
% \begin{plugdecl}{default}
% The caption begin socket takes an argument: the structure number of
% the parent float. If the argument is empty, the current structure is used.
% TODO: a tagpdf key that moves a structure to the begin of the parent.
+% The caption is moved to the first position with the firstkid option.
% \begin{macrocode}
\NewSocketPlug {tagsupport/caption/begin}{default}
{
\tl_if_empty:eTF {#1}
{
- \tag_struct_begin:n{tag=Caption}
-% \end{macrocode}
-% move the caption to the begin of the float structure:
-% \begin{macrocode}
- \seq_gpop_right:cN {g__tag_struct_kids_\tag_get:n{struct_num}_seq}\l_@@_tmpa_tl
- \seq_gput_left:cV {g__tag_struct_kids_\tag_get:n{struct_num}_seq}\l_@@_tmpa_tl
+ \tag_struct_begin:n{tag=Caption,firstkid}
}
{
- \tag_struct_begin:n{tag=Caption,parent=#1}
-% \end{macrocode}
-% move the caption to the begin of the float structure:
-% \begin{macrocode}
- \seq_gpop_right:cN {g__tag_struct_kids_#1_seq}\l_@@_tmpa_tl
- \seq_gput_left:cV {g__tag_struct_kids_#1_seq}\l_@@_tmpa_tl
+ \tag_struct_begin:n{tag=Caption,parent=#1,firstkid}
}
}
\AssignSocketPlug{tagsupport/caption/begin}{default}
@@ -575,6 +595,34 @@
\AssignSocketPlug{tagsupport/caption/end}{default}
% \end{macrocode}
% \end{plugdecl}
+%
+% \begin{plugdecl}{default (tagsupport/caption/label/begin)}
+% \begin{macrocode}
+\NewSocketPlug {tagsupport/caption/label/begin}{default}
+ {
+% \end{macrocode}
+% suppress para tagging at the begin.
+% \begin{macrocode}
+ \tagpdfparaOff
+ \tag_struct_begin:n{tag=Lbl}
+ \tag_mc_begin:n{}
+ }
+\AssignSocketPlug{tagsupport/caption/label/begin}{default}
+% \end{macrocode}
+% \end{plugdecl}
+%
+% \begin{plugdecl}{default (tagsupport/caption/label/end)}
+% \begin{macrocode}
+\NewSocketPlug {tagsupport/caption/label/end}{default}
+ {
+ \tag_mc_end:
+ \tag_struct_end:
+ \tagpdfparaOn
+ }
+\AssignSocketPlug{tagsupport/caption/label/end}{default}
+% \end{macrocode}
+% \end{plugdecl}
+%
% \subsubsection{Redefinitions}
%
% With hyperref that means that the \cs{refstepcounter} now can affect spacing so we
@@ -629,40 +677,29 @@
% We pass \cs{@current at float@struct} as parent structure
% number. If that is empty the socket will use the parent structure and hope ...
% \begin{macrocode}
- \UseTaggingSocket{\@current at float@struct}
-% \end{macrocode}
-% move the caption to the begin of the float structure:
-% \begin{macrocode}
- \tag_if_active:T
- {
- \seq_gpop_right:cN {g__tag_struct_kids_\@current at float@struct _seq}\l_@@_tmpa_tl
- \seq_gput_left:cV {g__tag_struct_kids_\@current at float@struct _seq}\l_@@_tmpa_tl
- }
+ \UseTaggingSocket{caption/begin}{\@current at float@struct}
\ifdim \wd\@tempboxa >\hsize
- \tag_struct_begin:n{tag=Lbl}
- \tag_mc_begin:n{}
- #1:~
- \tag_mc_end:
- \tag_struct_end:
- \tag_mc_begin:n{}
- #2\par
- \tag_mc_end:
+ \UseTaggingSocket{caption/label/begin}
+ \UseSocket{caption/label}{#1}
+ \UseTaggingSocket{caption/label/end}
+ \UseTaggingSocket{para/begin}
+ #2
+ \par
\else
% \end{macrocode}
% we don't reuse the box as it doesn't contain tagging, but set the text explicitly.
% \begin{macrocode}
\global \@minipagefalse
\hb at xt@\hsize{\hfil
- \tag_struct_begin:n{tag=Lbl}
- \tag_mc_begin:n{}
+ \UseTaggingSocket{caption/label/begin}
#1:~
- \tag_mc_end:
- \tag_struct_end:
- \tag_mc_begin:n{}
+ \UseTaggingSocket{caption/label/end}
+ \UseTaggingSocket{para/begin}
#2
- \tag_mc_end:\hfil}%
+ \UseTaggingSocket{para/end}
+ \hfil}%
\fi
- \tag_struct_end: %caption
+ \UseTaggingSocket{caption/end}
\vskip\belowcaptionskip}
}
% \end{macrocode}
diff --git a/required/latex-lab/testfiles-float/float-010-outside.luatex.tlg b/required/latex-lab/testfiles-float/float-010-outside.luatex.tlg
index 7681166b..27938bd0 100644
--- a/required/latex-lab/testfiles-float/float-010-outside.luatex.tlg
+++ b/required/latex-lab/testfiles-float/float-010-outside.luatex.tlg
@@ -1,17 +1,16 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
tagpdf DEBUG Info: Tagging suspended
-(tagpdf DEBUG) level: 0 ==> 1, label: caption [on line ...]
+(tagpdf DEBUG) level: 0 ==> 1, label: \@makecaption [on line ...]
tagpdf DEBUG Info: Tagging resumed
-(tagpdf DEBUG) level: 1 ==> 0, label: caption [on line ...]
+(tagpdf DEBUG) level: 1 ==> 0, label: \@makecaption [on line ...]
Package tagpdf Info: Parent-Child 'Document' --> 'Caption'.
(tagpdf) Relation is -1 (='∅')
(tagpdf) Rolemapped from: 'Document' --> 'Caption' on line ...
Package tagpdf Warning: Parent-Child 'Document/' --> 'Caption/pdf2'.
(tagpdf) Relation is not allowed (struct 2, /Document -->
(tagpdf) struct 5) on line ...
-tagpdf DEBUG Info: Struct 5 begin inserted with options:
-(tagpdf DEBUG) tag=Caption,parent=\@current at float@struct
+tagpdf DEBUG Info: Struct 5 begin inserted with options: tag=Caption,firstkid
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer
braces):
diff --git a/required/latex-lab/testfiles-float/float-010-outside.tlg b/required/latex-lab/testfiles-float/float-010-outside.tlg
index 6a80ca9d..55c94e3a 100644
--- a/required/latex-lab/testfiles-float/float-010-outside.tlg
+++ b/required/latex-lab/testfiles-float/float-010-outside.tlg
@@ -1,17 +1,16 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
tagpdf DEBUG Info: Tagging suspended
-(tagpdf DEBUG) level: 0 ==> 1, label: caption [on line ...]
+(tagpdf DEBUG) level: 0 ==> 1, label: \@makecaption [on line ...]
tagpdf DEBUG Info: Tagging resumed
-(tagpdf DEBUG) level: 1 ==> 0, label: caption [on line ...]
+(tagpdf DEBUG) level: 1 ==> 0, label: \@makecaption [on line ...]
Package tagpdf Info: Parent-Child 'Document' --> 'Caption'.
(tagpdf) Relation is -1 (='^^e2^^88^^85')
(tagpdf) Rolemapped from: 'Document' --> 'Caption' on line ...
Package tagpdf Warning: Parent-Child 'Document/' --> 'Caption/pdf2'.
(tagpdf) Relation is not allowed (struct 2, /Document -->
(tagpdf) struct 5) on line ...
-tagpdf DEBUG Info: Struct 5 begin inserted with options:
-(tagpdf DEBUG) tag=Caption,parent=\@current at float@struct
+tagpdf DEBUG Info: Struct 5 begin inserted with options: tag=Caption,firstkid
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer
braces):
More information about the latex3-commits
mailing list.