[latex3-commits] [latex3/latex2e] latexlab/tagging-9: some cleanup; some other parts should also use sockets but this will be done in a different branch (a077752f)

github at latex-project.org github at latex-project.org
Fri Sep 1 17:00:39 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : latexlab/tagging-9
Link       : https://github.com/latex3/latex2e/commit/a077752ff58379a0b31354f1b48fa4a06863018c

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

commit a077752ff58379a0b31354f1b48fa4a06863018c
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Fri Sep 1 17:00:39 2023 +0200

    some cleanup;
    some other parts should also use sockets but this will be done in a different branch


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

a077752ff58379a0b31354f1b48fa4a06863018c
 required/latex-lab/latex-lab-block.dtx | 65 ++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 30 deletions(-)

diff --git a/required/latex-lab/latex-lab-block.dtx b/required/latex-lab/latex-lab-block.dtx
index 94ffb037..80921359 100644
--- a/required/latex-lab/latex-lab-block.dtx
+++ b/required/latex-lab/latex-lab-block.dtx
@@ -26,6 +26,10 @@
 %
 % \fi
 %
+% \NewDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
+% \NewDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
+% \NewDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
+%
 %
 % \title{Prototype reimplementation of \LaTeXe{}'s block environments using templates}
 % \author{\LaTeX{} Project\thanks{Initial reimplementation of lists done by Bruno
@@ -1698,19 +1702,13 @@
 %    So this is for now always done. Probably \cs{l_@@_topsepadd_skip} above
 %    should be added only if the paragraph ends here and not if it
 %    continues, so this need some further cleanup.\fmi{decide}
+%    
+%    Finally, we have a socket that handles the \cs{par} handling
+%    after the block. Normally, we use it with the \plug{on} plug (check for a
+%    following \cs{par}) but in the case of standalone environments we
+%    assign it the \plug{off} plug.
 %    \begin{macrocode}
   \socket_use:n {tagsupport/block-endpe}
-%    \end{macrocode}
-%    It is possible that \texttt{@endpe} is true because a
-%    displayblock has just ended before we end the standalone
-%    displayblock and in that case there is no outer
-%    \struct{text-unit} so we have to explicitly set \texttt{@endpe}
-%    back to false to prevent it from closing a structure later that
-%    isn't there.
-%    \begin{macrocode}
-%  \bool_if:NTF \l_@@_standalone_bool
-%    { \legacy_if_gset_false:n { @endpe } }
-%    { \legacy_if_gset_true:n  { @endpe } }
 }
 %    \end{macrocode}
 %
@@ -1728,21 +1726,28 @@
 %
 %
 %
-%  \begin{macro}{\l_@@_standalone_bool}
-%    
+% \begin{socketdecl}{tagsupport/block-endpe}
+%    This socket is responsible for the end environment \cs{par}
+%    handling. We define two plugs for it (\plug{on} and \plug{off}).
 %    \begin{macrocode}
-%\bool_new:N       \l_@@_standalone_bool
-%\bool_set_false:N \l_@@_standalone_bool
-
 \socket_new:nn      {tagsupport/block-endpe}{0}
+%    \end{macrocode}
+% \end{socketdecl}
+%
+% \begin{plugdecl}{on,off}
+%    The plugs set the legacy \texttt{@endpe} switch. This must always
+%    happen because block environments with different settings can be nested
+%    and should not inherit the setting from the outer environment.
+%    \begin{macrocode}
 \socket_new_plug:nnn{tagsupport/block-endpe}{on}
                     { \legacy_if_gset_true:n  { @endpe } }
 \socket_new_plug:nnn{tagsupport/block-endpe}{off}
                     { \legacy_if_gset_false:n { @endpe } }
-
-\socket_assign_plug:nn{tagsupport/block-endpe}{on}
 %    \end{macrocode}
-%  \end{macro}
+%
+%    \begin{macrocode}
+\socket_assign_plug:nn{tagsupport/block-endpe}{on}
+% \end{plugdecl}
 %
 %
 %
@@ -2544,10 +2549,10 @@
                                               \@@_beginpar_vmode:
   \let \__kernel_displayblock_begin:          \prg_do_nothing:
   \let \__kernel_displayblock_end:            \prg_do_nothing:
-%
+%    \end{macrocode}
+%    End environment \cs{par} handling:
+%    \begin{macrocode}
   \socket_assign_plug:nn{tagsupport/block-endpe}{on}
-%\bool_set_false:N \l_@@_standalone_bool
-%
 }
 %    \end{macrocode}
 %  \end{macro}
@@ -2566,10 +2571,9 @@
   \cs_set_eq:NN \__kernel_displayblock_begin: \@@_inner_begin:
   \cs_set_eq:NN \__kernel_displayblock_end:   \@@_inner_end:
 %    \end{macrocode}
-%    
+%    End environment \cs{par} handling:
 %    \begin{macrocode}
   \socket_assign_plug:nn{tagsupport/block-endpe}{off}
-%  \bool_set_true:N \l_@@_standalone_bool
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
@@ -2606,10 +2610,10 @@
                                               \@@_beginpar_vmode:
   \cs_set_eq:NN \__kernel_displayblock_begin: \@@_inner_begin:
   \cs_set_eq:NN \__kernel_displayblock_end:   \@@_inner_end:
-%
+%    \end{macrocode}
+%    End environment \cs{par} handling:
+%    \begin{macrocode}
   \socket_assign_plug:nn{tagsupport/block-endpe}{on}
-%  \bool_set_false:N \l_@@_standalone_bool
-%
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
@@ -2660,11 +2664,12 @@
 %    \begin{macrocode}
   \cs_set_eq:NN \__kernel_list_item_begin:    \@@_list_item_begin:
   \cs_set_eq:NN \__kernel_list_item_end:      \@@_list_item_end:
-%
+%    \end{macrocode}
+%    End environment \cs{par} handling:
+%    \begin{macrocode}
   \socket_assign_plug:nn{tagsupport/block-endpe}{on}
-%  \bool_set_false:N \l_@@_standalone_bool
-%
 %    \end{macrocode}
+%
 %    Handle the tag name and attribute classess using the key values
 %    from the current list instance.
 %    \begin{macrocode}





More information about the latex3-commits mailing list.