[latex3-commits] [latex3/latex2e] latex-lab/uf-review-05: begin with sockets (5a89cf37)

github at latex-project.org github at latex-project.org
Thu Nov 16 00:34:18 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : latex-lab/uf-review-05
Link       : https://github.com/latex3/latex2e/commit/5a89cf37b7b7ee9191a3a9fe5e10e755ad689d75

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

commit 5a89cf37b7b7ee9191a3a9fe5e10e755ad689d75
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Nov 16 00:34:18 2023 +0100

    begin with sockets


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

5a89cf37b7b7ee9191a3a9fe5e10e755ad689d75
 required/latex-lab/latex-lab-math.dtx | 115 ++++++++++++++++++++++++----------
 1 file changed, 83 insertions(+), 32 deletions(-)

diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx
index b8b18e8d..591a9702 100644
--- a/required/latex-lab/latex-lab-math.dtx
+++ b/required/latex-lab/latex-lab-math.dtx
@@ -46,7 +46,14 @@
 % \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}}
 % \providecommand\class[1]{\texttt{#1.cls}}
 % \providecommand\pkg[1]{\texttt{#1}}
-% \providecommand\hook[1]{\texttt{#1}}
+%
+% \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
+% \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
+% \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
+%
+% \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}
 %
 % ^^A \car {...} for marginal comments
 % ^^A \car*{...} for longer inline comments
@@ -344,26 +351,6 @@
 \bool_new:N \l_@@_fakemath_bool
 %    \end{macrocode}
 % \end{variable}
-
-%
-% It must be possible to suppress both the collecting and the tagging of math. 
-% Currently both tasks are still connected and controlled by the boolean
-% \cs{l_@@_collected_bool} so we define only commands for the tagging case.
-% As these will probably be needed in more than one place in the
-% testphase we check for existence. 
-% TODO: At the end they should move to tagpdf.
-%
-% \begin{macro}{\__tag_math_disable:,\__tag_math_enable:}
-%    \begin{macrocode}
-\cs_if_free:NT \__tag_math_disable:
- {
-   \cs_new_protected:Npn \__tag_math_disable: 
-     { \bool_set_true:N \l_@@_collected_bool }
-   \cs_new_protected:Npn \__tag_math_enable: 
-     { \bool_set_false:N \l_@@_collected_bool }
- }
-%    \end{macrocode}
-% \end{macro}
 %
 %
 %  \car{Change first tl name below: `env' $=>$ `info'?\\
@@ -379,6 +366,73 @@
 %    \end{macrocode}
 % \end{variable}
 % 
+% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpa_skip}
+% Temporary variables
+%    \begin{macrocode}
+\tl_new:N \l_@@_tmpa_tl
+\skip_new:N \l_@@_tmpa_skip
+%    \end{macrocode}
+% \end{variable}
+%
+% \subsection{Sockets}
+%
+% \begin{socketdecl}{tagsupport/math/inline/begin,
+%                    tagsupport/math/inline/end,
+%                    tagsupport/math/formula/begin,
+%                    tagsupport/math/formula/end,
+%                   }
+%   The first two sockets are meant to embed inline
+%   math into the surrounding (so to close/reopen e.g. MC-chunks).
+%   The other two implement the actual formula structure.                 
+%    \begin{macrocode}
+\socket_new:nn {tagsupport/math/inline/begin}{0}
+\socket_new:nn {tagsupport/math/inline/end}{0}
+\socket_new:nn {tagsupport/math/formula/begin}{0} %or 1?
+\socket_new:nn {tagsupport/math/formula/end}{0}
+%    \end{macrocode}
+%\end{socketdecl}
+%
+% \begin{plugdecl}{MC}
+%    \begin{macrocode}
+\socket_new_plug:nnn
+  {tagsupport/math/inline/begin}
+  {MC}
+  {\tag_mc_end_push:}
+\socket_new_plug:nnn
+  {tagsupport/math/inline/end}
+  {MC}
+  {\tag_mc_begin_pop:n{}}  
+%    \end{macrocode}
+% \end{plugdecl}
+% 
+%  \begin{macro}{\__tag_math_disable:}
+%  Similar to the table code we collect the plugs that should be
+%  assigned to do nothing if we don't want tagging
+%    \begin{macrocode}
+\cs_new_protected:Npn \__tag_math_disable: 
+  {
+    \socket_assign_plug:nn {tagsupport/math/inline/begin}{noop}
+    \socket_assign_plug:nn {tagsupport/math/inline/end}{noop}
+  } 
+%    \end{macrocode}
+% \end{macro}
+% 
+%  \begin{macro}{\__tag_math_enable:}
+%  Similar to the table code we collect the default plugs that should be
+%  assigned if we want tagging
+%    \begin{macrocode}
+\cs_new_protected:Npn \__tag_math_enable: 
+  {
+    \socket_assign_plug:nn {tagsupport/math/inline/begin}{MC}
+    \socket_assign_plug:nn {tagsupport/math/inline/end}{MC}
+  } 
+%    \end{macrocode}
+% \end{macro}
+% At begin document we can activate:
+%    \begin{macrocode}
+\AtBeginDocument{\tag_if_active:T{\__tag_math_enable: }}
+%    \end{macrocode}
+%
 % \subsection{Interface commands}
 %
 % \begin{macro}
@@ -447,19 +501,17 @@
 % see https://github.com/latex3/tagging-project/issues/5
 % TODO: use socket to get more control about typesetting variants (tagged, drop etc)?
 %    \begin{macrocode}
-        \legacy_if:nTF { measuring@ }
-          { #1 $ }
-          {
-            \tl_if_in:nnTF {#1} { \m at th }
-              { #1 $ }
-              {
-                \tagmcend %end P-chunk, in code: \tag_mc_end_push:
+      \bool_lazy_or:nnTF 
+        {\legacy_if_p:n { measuring@ }}
+        { \l_@@_fakemath_bool }
+        { #1 $ }
+        {
+            \socket_use:n {tagsupport/math/inline/begin} %end P-MC  
                 \@kernel at math@begin
                 #1 $
                 \@kernel at math@end
-                \tagmcbegin{}  % restart P-chunk (whatsits in pdftex)
-              }
-          }
+            \socket_use:n {tagsupport/math/inline/end} % restart P-MC
+        }         
       }
   }
 %    \end{macrocode}
@@ -468,7 +520,6 @@
 %   And for the classical \TeX{} display structure.
 %    \begin{macrocode}
 
-\skip_new:N \l_@@_tmpa_skip
 
 \cs_new_protected:Npn \@@_grab_dollardollar:w % $$
   #1 $$





More information about the latex3-commits mailing list.