[latex3-commits] [l3svn] r6654 - Refactoring l3doc: generate predicate name in an auxiliary
noreply at latex-project.org
noreply at latex-project.org
Sun Aug 14 18:54:06 CEST 2016
Author: bruno
Date: 2016-08-14 18:54:06 +0200 (Sun, 14 Aug 2016)
New Revision: 6654
Modified:
trunk/l3kernel/l3doc.dtx
Log:
Refactoring l3doc: generate predicate name in an auxiliary
Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx 2016-08-14 16:28:51 UTC (rev 6653)
+++ trunk/l3kernel/l3doc.dtx 2016-08-14 16:54:06 UTC (rev 6654)
@@ -567,6 +567,14 @@
%
% \subsection{Variants and helpers}
%
+% \begin{macro}[aux]{\@@_tmpa:w, \@@_tmpb:w}
+% Auxiliary macros for temporary use.
+% \begin{macrocode}
+\cs_new_eq:NN \@@_tmpa:w ?
+\cs_new_eq:NN \@@_tmpb:w ?
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}
% {
% \tl_count:f,
@@ -702,17 +710,33 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\@@_predicate_from_base:N}
-% Get predicate from a function's base name. This \enquote{works} for
-% functions with no signature too.
+% \begin{macro}[aux]{\@@_predicate_from_base:N, \@@_predicate_from_base:n}
+% \begin{macro}[aux]{\@@_predicate_from_base_aux:w, \@@_predicate_from_base_auxii:w}
+% Get predicate from a function's base name. The code is not broken
+% by functions with no signature. The |n|-type version can be used
+% for keys and other non-control sequences. The output is a string.
% \begin{macrocode}
\cs_new:Npn \@@_predicate_from_base:N #1
{
\__cs_get_function_name:N #1 _p:
\__cs_get_function_signature:N #1
}
+\cs_set_protected:Npn \@@_tmpa:w #1
+ {
+ \cs_new:Npn \@@_predicate_from_base:n ##1
+ {
+ \exp_after:wN \@@_predicate_from_base_aux:w
+ \tl_to_str:n {##1} \q_mark #1 \q_stop
+ }
+ \cs_new:Npn \@@_predicate_from_base_aux:w ##1 #1
+ { \@@_predicate_from_base_auxii:w ##1 _p: }
+ }
+\exp_args:No \@@_tmpa:w { \token_to_str:N : }
+\cs_new:Npn \@@_predicate_from_base_auxii:w #1 \q_mark #2 \q_stop
+ { \tl_to_str:n {#1} }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}[aux]
% {
@@ -1047,14 +1071,6 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[aux]{\@@_tmpa:w, \@@_tmpb:w}
-% Auxiliary macros for temporary use.
-% \begin{macrocode}
-\cs_new_eq:NN \@@_tmpa:w ?
-\cs_new_eq:NN \@@_tmpb:w ?
-% \end{macrocode}
-% \end{macro}
-%
% ^^A Bruno: what does the next line do?
% \begin{macrocode}
% \int_new:N \c at CodelineNo
@@ -1488,7 +1504,7 @@
% \end{macrocode}
% \end{environment}
%
-% \subsubsection{Implementing text markup}
+% \subsection{Implementing text markup}
%
% Keys for \cs{cmd}, \cs{cs} and \cs{tn}.
% \begin{macrocode}
@@ -2245,12 +2261,7 @@
{
\bool_set_false:N \l_@@_macro_TF_bool
\seq_map_inline:Nn \l_@@_macro_input_seq
- {
- \tl_set:Nn \l_@@_tmpa_tl {##1}
- \tl_replace_once:Noo \l_@@_tmpa_tl
- { \tl_to_str:n { : } } { \tl_to_str:n { _p: } }
- \exp_args:No #1 \l_@@_tmpa_tl
- }
+ { \exp_args:Nx #1 { \@@_predicate_from_base:n {##1} } }
\bool_set_true:N \l_@@_macro_TF_bool
}
\seq_map_function:NN \l_@@_macro_input_seq #1
More information about the latex3-commits
mailing list