[latex3-commits] [git/LaTeX3-latex3-latex3] master: Detect foreign internals in macrocode, macro, function but not cs, cmd, tn (f66e5ed)

Bruno Le Floch bruno at le-floch.fr
Fri Mar 30 05:37:30 CEST 2018


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

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

commit f66e5edf5ffb1388ffec2b90a1e79f41a186562c
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Thu Mar 29 23:37:30 2018 -0400

    Detect foreign internals in macrocode, macro, function but not cs, cmd, tn
    
    The idea is that one can refer to a foreign internal by \cs{__foreign_..}
    but not document it using \begin{function}{\__foreign_...} or similar, nor
    use it in code wrapped by macrocode.


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

f66e5edf5ffb1388ffec2b90a1e79f41a186562c
 l3kernel/l3doc.dtx |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 711873f..b0116b5 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -564,7 +564,8 @@ and all files in that bundle must be distributed together.
 % \begin{variable}{\l_@@_detect_internals_bool, \l_@@_detect_internals_tl}
 %   If \texttt{true}, \pkg{l3doc} will check for use of internal
 %   commands \cs[no-index]{__\meta{pkg}_\ldots{}} from other packages in
-%   \texttt{macrocode} environments and in~\cs{cs}.  Also a token list
+%   the argument of the \texttt{macro} environment, and in the code typeset in
+%   \texttt{macrocode} environments, but not in~\cs{cs}.  Also a token list
 %   to store temporary data for this purpose.
 %    \begin{macrocode}
 \bool_new:N \l_@@_detect_internals_bool
@@ -1026,11 +1027,6 @@ and all files in that bundle must be distributed together.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_replace_at_at:N #1
   {
-    \bool_if:NT \l_@@_in_implementation_bool
-      {
-        \bool_if:NT \l_@@_detect_internals_bool
-          { \@@_detect_internals:N #1 }
-      }
     \tl_if_empty:NF \g_@@_module_name_tl
       {
         \exp_args:NNo \@@_replace_at_at_aux:Nn
@@ -1051,7 +1047,12 @@ and all files in that bundle must be distributed together.
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\@@_detect_internals:N, \@@_if_detect_internals_ok:NF}
+% \begin{macro}
+%   {
+%     \@@_detect_internals:N,
+%     \@@_detect_internals_aux:N,
+%     \@@_if_detect_internals_ok:NF
+%   }
 %   After splitting at each |__| and removing the leading item from the
 %   sequence (since it does not follow |__|), remove everything after
 %   any space or end-of-line to get a good approximation of the control
@@ -1062,9 +1063,14 @@ and all files in that bundle must be distributed together.
 %   remove anything after any |_| or |:| (with either catcode) to get a
 %   guess of the module name.
 %    \begin{macrocode}
+\cs_new_protected:Npn \@@_detect_internals:N #1
+  {
+    \bool_if:NT \l_@@_detect_internals_bool
+      { \@@_detect_internals_aux:N #1 }
+  }
 \group_begin:
   \char_set_catcode_active:N \^^M
-  \cs_new_protected:Npn \@@_detect_internals:N #1
+  \cs_new_protected:Npn \@@_detect_internals_aux:N #1
     {
       \tl_set_eq:NN \l_@@_detect_internals_tl #1
       \tl_replace_all:Non \l_@@_detect_internals_tl { \token_to_str:N _ } { _ }
@@ -2092,6 +2098,7 @@ and all files in that bundle must be distributed together.
         \tl_remove_all:Nx \l_@@_tmpa_tl { \tl_to_str:n { ^ ^ A } }
         \tl_remove_all:Nx \l_@@_tmpa_tl { \iow_char:N \^^I }
         \tl_remove_all:Nx \l_@@_tmpa_tl { \iow_char:N \^^M }
+        \@@_detect_internals:N \l_@@_tmpa_tl
         \@@_replace_at_at:N \l_@@_tmpa_tl
         \exp_args:NNx \seq_set_from_clist:Nn #2
           { \tl_to_str:N \l_@@_tmpa_tl }
@@ -3680,6 +3687,7 @@ and all files in that bundle must be distributed together.
         { \@@_xmacro_code:w #1 \q_stop }
         {
           \tl_set:Nn \l_@@_tmpa_tl {#1}
+          \@@_detect_internals:N \l_@@_tmpa_tl
           \@@_replace_at_at:N \l_@@_tmpa_tl
           \tl_use:N \l_@@_tmpa_tl
         }
@@ -3687,12 +3695,14 @@ and all files in that bundle must be distributed together.
   \cs_new_protected:Npn \@@_xmacro_code:w #1 < @ @ = #2 > #3 \q_stop
     {
       \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 { < @ @ = #2 > }
 
       \tl_set:Nn \l_@@_tmpb_tl {#3}
+      \@@_detect_internals:N \l_@@_tmpb_tl
       \@@_replace_at_at:N \l_@@_tmpb_tl
       \tl_put_right:No \l_@@_tmpa_tl { \l_@@_tmpb_tl }
 





More information about the latex3-commits mailing list