[latex3-commits] [l3svn] r6662 - l3doc: in "End definition" text include nested macros

noreply at latex-project.org noreply at latex-project.org
Mon Aug 15 18:43:49 CEST 2016


Author: bruno
Date: 2016-08-15 18:43:49 +0200 (Mon, 15 Aug 2016)
New Revision: 6662

Modified:
   trunk/l3kernel/l3doc.dtx
Log:
l3doc: in "End definition" text include nested macros

When macro environments are nested the text "End definition for (macro 
names)" now includes all macros names that appear in nested macro 
environments, truncated to at most 3 as earlier.


Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx	2016-08-15 16:31:23 UTC (rev 6661)
+++ trunk/l3kernel/l3doc.dtx	2016-08-15 16:43:49 UTC (rev 6662)
@@ -727,6 +727,14 @@
 %    \end{macrocode}
 % \end{variable}
 %
+% \begin{variable}[int]{\g_@@_nested_names_seq}
+%   Collects all macros in nested \env{macro} environments, to use them
+%   in the ``End definition'' text.
+%    \begin{macrocode}
+\seq_new:N \g_@@_nested_names_seq
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{variable}[int]{\c_@@_backslash_tl, \c_@@_backslash_token}
 %   A single backslash, as a token list, or as an implicit character
 %   token.
@@ -2472,6 +2480,7 @@
   }
 \cs_new_protected:Npn \@@_macro_index:nN #1#2
   {
+    \seq_gput_right:Nn \g_@@_nested_names_seq {#1}
     \bool_if:NTF #2
       {
         \bool_if:NF \l_@@_macro_aux_bool
@@ -2643,11 +2652,8 @@
     \@@_macro_end_check_tested:
     \int_compare:nNnT \l_@@_nested_macro_int = 1
       {
-        \@@_macro_end_style:n
-          {
-            \@@_print_end_definition:
-            \@@_print_documented:
-          }
+        \@@_macro_end_style:n { \@@_print_end_definition: }
+        \seq_gclear:N \g_@@_nested_names_seq
       }
   }
 %    \end{macrocode}
@@ -2694,43 +2700,36 @@
 % \begin{macro}[aux]
 %   {
 %     \@@_print_end_definition:,
-%     \@@_macro_end_wrap_items:N,
+%     \@@_macro_end_wrap_item:n,
 %     \@@_print_documented:
 %   }
-%   Surround each item by \tn{texttt} and |TF| if needed, replacing |_|
+%   Surround each item by \tn{texttt}, replacing |_|
 %   by \tn{_} as well.  Then list the
 %   macro names through \cs{seq_use:Nnnn}, unless there are too many.
 %   Finally, if the macro is neither auxiliary nor internal, add a link
 %   to where it is documented.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_macro_end_wrap_items:N #1
+\cs_new_protected:Npn \@@_macro_end_wrap_item:n #1
   {
-    \bool_if:NT \l_@@_macro_TF_bool
-      { \seq_set_map:NNn #1 #1 { ##1 TF } }
-    \seq_set_map:NNn #1 #1
-      {
-        \exp_not:n
-          {
-            \tl_set:Nn \l_@@_tmpa_tl {##1}
-            \tl_replace_all:Non \l_@@_tmpa_tl
-              { \token_to_str:N _ } { \_ }
-            \texttt { \l_@@_tmpa_tl }
-          }
-      }
+    \tl_set:Nn \l_@@_tmpa_tl {#1}
+    \tl_replace_all:Non \l_@@_tmpa_tl
+      { \token_to_str:N _ } { \_ }
+    \texttt { \l_@@_tmpa_tl }
   }
 \cs_new_protected:Npn \@@_print_end_definition:
   {
-    \group_begin:
-    \@@_macro_end_wrap_items:N \l_@@_names_seq
+    \seq_gset_map:NNn \g_@@_nested_names_seq
+      \g_@@_nested_names_seq
+      { \exp_not:n { \@@_macro_end_wrap_item:n {##1} } }
     End~ definition~ for~
-    \int_compare:nTF { \seq_count:N \l_@@_names_seq <= 3 }
+    \int_compare:nTF { \seq_count:N \g_@@_nested_names_seq <= 3 }
       {
-        \seq_use:Nnnn \l_@@_names_seq
+        \seq_use:Nnnn \g_@@_nested_names_seq
           { \,~and~ } { \,,~ } { \,,~and~ }
-        \@.
       }
-      { \seq_item:Nn \l_@@_names_seq {1}\,~and~others. }
-    \group_end:
+      { \seq_item:Nn \g_@@_nested_names_seq {1}\,~and~others }
+    \@.
+    \@@_print_documented:
   }
 \cs_new_protected:Npn \@@_print_documented:
   {
@@ -2741,13 +2740,13 @@
       }
       {
         \int_set:Nn \l_@@_tmpa_int
-          { \seq_count:N \l_@@_names_seq }
+          { \seq_count:N \g_@@_nested_names_seq }
         \int_compare:nNnTF \l_@@_tmpa_int = 1 {~This~} {~These~}
         \bool_if:NTF \l_@@_macro_var_bool {variable} {function}
         \int_compare:nNnTF \l_@@_tmpa_int = 1 {~is~} {s~are~}
         documented~on~page~
         \exp_args:Nx \@@_get_hyper_target:nN
-          { \seq_item:Nn \l_@@_names_seq { 1 } }
+          { \seq_item:Nn \g_@@_nested_names_seq { 1 } }
           \l_@@_tmpa_tl
         \exp_args:Nx \pageref { \l_@@_tmpa_tl } .
       }



More information about the latex3-commits mailing list