[latex3-commits] [git/latex3] master: Support betwee multi-word @@ in l3doc (fixes #428) (5ddcd0f)
Bruno Le Floch
bruno at le-floch.fr
Sun Jan 14 21:25:39 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/5ddcd0fa492c5f687e775ae802b3bd1ab1bd2f08
>---------------------------------------------------------------
commit 5ddcd0fa492c5f687e775ae802b3bd1ab1bd2f08
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Sun Jan 14 15:25:39 2018 -0500
Support betwee multi-word @@ in l3doc (fixes #428)
Now l3doc checks that after "__" there is
- the "@@" module name followed by and ":" or "_"
- or "kernel_" when the appropriate option is given.
>---------------------------------------------------------------
5ddcd0fa492c5f687e775ae802b3bd1ab1bd2f08
l3kernel/l3doc.dtx | 80 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 52 insertions(+), 28 deletions(-)
diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 7f600a1..dbbff4c 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3doc.dtx Copyright (C) 1990-2017 The LaTeX3 project
+%% File: l3doc.dtx Copyright (C) 1990-2018 The LaTeX3 project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -949,7 +949,7 @@ and all files in that bundle must be distributed together.
\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT { o }
\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNF { o }
\cs_generate_variant:Nn \tl_if_head_eq_meaning:nNF { V }
-\cs_generate_variant:Nn \tl_if_in:nnTF { no }
+\cs_generate_variant:Nn \tl_if_in:nnTF { no , oo }
\cs_generate_variant:Nn \tl_if_in:NnTF { No }
\cs_generate_variant:Nn \tl_if_in:NnT { No }
\cs_generate_variant:Nn \tl_if_in:NnF { No }
@@ -995,6 +995,22 @@ and all files in that bundle must be distributed together.
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[TF]{\@@_str_if_begin:nn, \@@_str_if_begin:oo}
+% True if the first string starts with the second.
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \@@_str_if_begin:nn #1#2 { TF , T , F }
+ {
+ \tl_if_in:ooTF
+ { \exp_after:wN \scan_stop: \tl_to_str:n {#1} }
+ { \exp_after:wN \scan_stop: \tl_to_str:n {#2} }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn \@@_str_if_begin:nn
+ { oo } { TF , T , F }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_replace_at_at:N}
% \begin{macro}{\@@_replace_at_at_aux:Nn}
% The goal is to replace |@@| by the current module name. We take
@@ -1035,14 +1051,16 @@ and all files in that bundle must be distributed together.
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_detect_internals:N}
+% \begin{macro}{\@@_detect_internals: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
-% sequence (for the warning message), then remove anything after any
-% |_| or |:| (with either catcode) to get the module name. If that
-% name is not empty and differs from the current |@@| name then
-% complain.
+% sequence (for the warning message). Then check if that starts with
+% something allowed: |@@| module name and |:| or |_|, or if the
+% relevant boolean is set |kernel_| (it seems safe to assume we will
+% not define a |\__kernel:...| command). For the message itself
+% remove anything after any |_| or |:| (with either catcode) to get a
+% guess of the module name.
% \begin{macrocode}
\group_begin:
\char_set_catcode_active:N \^^M
@@ -1057,32 +1075,38 @@ and all files in that bundle must be distributed together.
\@@_trim_right:No \l_@@_detect_internals_tl
\c_catcode_active_space_tl
\@@_trim_right:Nn \l_@@_detect_internals_tl ^^M
- \tl_set_eq:NN \l_@@_detect_internals_cs_tl \l_@@_detect_internals_tl
- \@@_trim_right:Nn \l_@@_detect_internals_tl _
- \@@_trim_right:Nn \l_@@_detect_internals_tl :
- \@@_trim_right:No \l_@@_detect_internals_tl { \token_to_str:N : }
- \tl_if_empty:NF \l_@@_detect_internals_tl
+ \@@_if_detect_internals_ok:NF \l_@@_detect_internals_tl
{
- \str_if_eq:NNF \l_@@_detect_internals_tl \g_@@_module_name_tl
- {
- \bool_lazy_and:nnF
- { \g_@@_kernel_bool }
- {
- \str_if_eq_x_p:nn
- { \tl_to_str:N \l_@@_detect_internals_tl }
- { kernel }
- }
- {
- \msg_warning:nnxxx { l3doc } { foreign-internal }
- { \tl_to_str:N \l_@@_detect_internals_cs_tl }
- { \tl_to_str:N \l_@@_detect_internals_tl }
- { \tl_to_str:N \g_@@_module_name_tl }
- }
- }
+ \tl_set_eq:NN \l_@@_detect_internals_cs_tl \l_@@_detect_internals_tl
+ \@@_trim_right:Nn \l_@@_detect_internals_tl _
+ \@@_trim_right:Nn \l_@@_detect_internals_tl :
+ \@@_trim_right:No \l_@@_detect_internals_tl { \token_to_str:N : }
+ \msg_warning:nnxxx { l3doc } { foreign-internal }
+ { \tl_to_str:N \l_@@_detect_internals_cs_tl }
+ { \tl_to_str:N \l_@@_detect_internals_tl }
+ { \tl_to_str:N \g_@@_module_name_tl }
}
}
}
\group_end:
+\prg_new_protected_conditional:Npnn \@@_if_detect_internals_ok:N #1 { F }
+ {
+ \@@_str_if_begin:ooTF {#1} { \g_@@_module_name_tl _ }
+ { \prg_return_true: }
+ {
+ \@@_str_if_begin:ooTF {#1} { \g_@@_module_name_tl : }
+ { \prg_return_true: }
+ {
+ \bool_if:NTF \g_@@_kernel_bool
+ {
+ \@@_str_if_begin:ooTF {#1} { kernel _ }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_false: }
+ }
+ }
+ }
% \end{macrocode}
% \end{macro}
%
More information about the latex3-commits
mailing list