[latex3-commits] [git/LaTeX3-latex3-latex3] master: Allow multiple <@@= in one macrocode (fixes #595) (#596) (97daab845)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Jun 27 11:07:33 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/97daab8459d2165ebb7f86d97c3a1701c61d7037

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

commit 97daab8459d2165ebb7f86d97c3a1701c61d7037
Author: Phelype Oleinik <phe.h.o1 at gmail.com>
Date:   Thu Jun 27 06:07:33 2019 -0300

    Allow multiple <@@= in one macrocode (fixes #595) (#596)


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

97daab8459d2165ebb7f86d97c3a1701c61d7037
 l3kernel/l3doc.dtx | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 1bbc500dc..9d3976aae 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -3786,9 +3786,9 @@ and all files in that bundle must be distributed together.
 %   name automatically.  We need to be careful: no |<@@=| should appear
 %   as such in the code below since \pkg{l3doc} is also typeset using
 %   this code.
-%   TODO: right now, in a line containing |<@@=|\meta{module}|>|, the
-%   |@@| are replaced (using different values of the \meta{module}
-%   before and after the assignment).  Is this a waste?
+%   At each |<@@=| found, replace the \meta{module} in the code behind
+%   it, update the \meta{module}, and loop to check for further
+%   occurrences of |<@@=|.
 %    \begin{macrocode}
 \group_begin:
   \char_set_catcode_other:N \^^A
@@ -3813,8 +3813,9 @@ and all files in that bundle must be distributed together.
   \char_set_catcode_active:N \>
   \cs_new_protected:Npn \@@_xmacro_code:n #1
     {
+      \tl_clear:N \l_@@_tmpa_tl
       \tl_if_in:nnTF {#1} { < @ @ = }
-        { \@@_xmacro_code:w #1 \q_stop }
+        { \@@_xmacro_code:w #1 < @ @ = \q_recursion_tail > \q_recursion_stop }
         {
           \tl_set:Nn \l_@@_tmpa_tl {#1}
           \@@_detect_internals:N \l_@@_tmpa_tl
@@ -3822,21 +3823,21 @@ and all files in that bundle must be distributed together.
           \tl_use:N \l_@@_tmpa_tl
         }
     }
-  \cs_new_protected:Npn \@@_xmacro_code:w #1 < @ @ = #2 > #3 \q_stop
+  \cs_new_protected:Npn \@@_xmacro_code:w #1 < @ @ = #2 >
     {
-      \tl_set:Nn \l_@@_tmpa_tl {#1}
-      \@@_detect_internals:N \l_@@_tmpa_tl
-      \@@_replace_at_at:N \l_@@_tmpa_tl
-
-      \tl_gset:Nn \g_@@_module_name_tl {#2}
-      \tl_put_right:Nn \l_@@_tmpa_tl { < \text { \verbatim at font @ @ = #2 } > }
-
-      \tl_set:Nn \l_@@_tmpb_tl {#3}
+      % Add code before <@@=...>
+      \tl_set:Nn \l_@@_tmpb_tl {#1}
       \@@_detect_internals:N \l_@@_tmpb_tl
       \@@_replace_at_at:N \l_@@_tmpb_tl
-      \tl_put_right:No \l_@@_tmpa_tl { \l_@@_tmpb_tl }
-
-      \tl_use:N \l_@@_tmpa_tl
+      \tl_put_right:NV \l_@@_tmpa_tl \l_@@_tmpb_tl
+      % Check for \q_recursion_tail
+      \quark_if_recursion_tail_stop_do:nn {#2}
+        { \tl_use:N \l_@@_tmpa_tl }
+      % Change module name and add <@@=#2> to typeset output
+      \tl_gset:Nn \g_@@_module_name_tl {#2}
+      \tl_put_right:Nn \l_@@_tmpa_tl { < \text { \verbatim at font @ @ = #2 } > }
+      % Loop
+      \@@_xmacro_code:w
     }
 \group_end:
 %    \end{macrocode}





More information about the latex3-commits mailing list