summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3keys.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3keys.dtx82
1 files changed, 51 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
index c300e3e5ee3..9919abfd869 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
@@ -2,7 +2,7 @@
%
%% File: l3keys.dtx
%
-% Copyright (C) 2006-2023 The LaTeX Project
+% Copyright (C) 2006-2024 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -31,7 +31,7 @@
% \fi
%
% \title{^^A
-% The \pkg{l3keys} package\\ Key--value interfaces^^A
+% The \pkg{l3keys} module\\ Key--value interfaces^^A
% }
%
% \author{^^A
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2023-12-11}
+% \date{Released 2024-01-04}
%
% \maketitle
%
@@ -775,12 +775,14 @@
% If a key has not previously been defined (is unknown), \cs{keys_set:nn}
% looks for a special \texttt{unknown} key for the same module, and if this is
% not defined raises an error indicating that the key name was unknown. This
-% mechanism can be used for example to issue custom error texts.
+% mechanism can be used for example to issue custom error texts. The
+% \texttt{unknown} key also supports the \texttt{.default:n} property.
% \begin{verbatim}
% \keys_define:nn { mymodule }
% {
% unknown .code:n =
-% You~tried~to~set~key~'\l_keys_key_str'~to~'#1'.
+% You~tried~to~set~key~'\l_keys_key_str'~to~'#1'. ,
+% unknown .default:V = \c_novalue_tl
% }
% \end{verbatim}
%
@@ -1344,9 +1346,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_misplaced_equal_after_active_error:w
\s_@@_mark ##1 \s_@@_stop \s_@@_mark ##2 \s_@@_nil
- = \s_@@_mark \@@_split_active_auxii:w
- \s_@@_mark ##3 \s_@@_nil
- #2 \s_@@_mark \@@_clean_up_active:w
+ = \s_@@_mark \@@_split_active_auxii:w
+ \s_@@_mark ##3 \s_@@_nil
+ #2 \s_@@_mark \@@_clean_up_active:w
{
\msg_expandable_error:nn
{ keyval } { misplaced-equals-sign }
@@ -1813,28 +1815,29 @@
% \end{macro}
%
% \begin{macro}{\@@_property_find:n}
-% \begin{macro}
+% \begin{macro}[EXP]{\@@_property_find_auxi:w}
+% \begin{macro}{\@@_property_find_auxii:w}
+% \begin{macro}[EXP]
% {
-% \@@_property_find_auxi:w ,
-% \@@_property_find_auxii:w ,
% \@@_property_find_auxiii:w ,
% \@@_property_find_auxiv:w
% }
+% \begin{macro}{\@@_property_find_err:w}
% Searching for a property means finding the last |.| in the input,
-% and storing the text before and after it. Everything is turned into
-% strings, so there is no problem using an \texttt{e}-type expansion. Since
-% \cs{@@_trim_spaces:n} will turn its argument into a string anyway, this
-% function uses \cs{cs_set_nopar:Npe} instead of \cs{tl_set:Ne} to gain some
-% speed.
+% and storing the text before and after it. Everything is first turned into
+% strings, so there is no problem using \cs{cs_set_nopar:Npe} instead of
+% \cs{str_set:Ne} to set \cs{l_keys_path_str}. To gain further speed, brace
+% tricks are used and \cs{@@_property_find_auxiv:w} is defined as expandable.
+% Since spaces will already be trimmed from the module we can omit it from the
+% argument to \cs{@@_trim_spaces:n}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_property_find:n #1
{
- \cs_set_nopar:Npe \l_@@_property_str { \@@_trim_spaces:n { #1 } }
- \exp_after:wN \@@_property_find_auxi:w \l_@@_property_str
+ \exp_after:wN \@@_property_find_auxi:w \tl_to_str:n {#1}
\s_@@_nil \@@_property_find_auxii:w
. \s_@@_nil \@@_property_find_err:w
}
-\cs_new_protected:Npn \@@_property_find_auxi:w #1 . #2 \s_@@_nil #3
+\cs_new:Npn \@@_property_find_auxi:w #1 . #2 \s_@@_nil #3
{
#3 #1 \s_@@_mark #2 \s_@@_nil #3
}
@@ -1843,22 +1846,24 @@
\@@_property_find_err:w
{
\cs_set_nopar:Npe \l_keys_path_str
- { \str_if_empty:NF \l_@@_module_str { \l_@@_module_str / } #1 }
- \@@_property_find_auxi:w #2 \s_@@_nil \@@_property_find_auxiii:w . \s_@@_nil
- \@@_property_find_auxiv:w
+ {
+ \str_if_empty:NF \l_@@_module_str { \l_@@_module_str / }
+ \exp_after:wN \@@_trim_spaces:n \tex_expanded:D {{
+ #1
+ \if_false: }}} \fi:
+ \@@_property_find_auxi:w #2 \s_@@_nil \@@_property_find_auxiii:w
+ . \s_@@_nil \@@_property_find_auxiv:w
}
-\cs_new_protected:Npn \@@_property_find_auxiii:w #1 \s_@@_mark
+\cs_new:Npn \@@_property_find_auxiii:w #1 \s_@@_mark #2 . #3 \s_@@_nil #4
{
- \cs_set_nopar:Npe \l_keys_path_str { \l_keys_path_str . #1 }
- \@@_property_find_auxi:w
+ . #1 #4 #2 \s_@@_mark #3 \s_@@_nil #4
}
-\cs_new_protected:Npn \@@_property_find_auxiv:w
+\cs_new:Npn \@@_property_find_auxiv:w
#1 \s_@@_nil \@@_property_find_auxiii:w
\s_@@_mark \s_@@_nil \@@_property_find_auxiv:w
{
+ \if_false: {{{ \fi: }}}
\cs_set_nopar:Npe \l_@@_property_str { . #1 }
- \cs_set_nopar:Npe \l_keys_path_str
- { \exp_after:wN \@@_trim_spaces:n \exp_after:wN { \l_keys_path_str } }
\tl_set_eq:NN \l_keys_path_tl \l_keys_path_str
}
\cs_new_protected:Npn \@@_property_find_err:w
@@ -1870,6 +1875,9 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_define_code:n}
% \begin{macro}[EXP]{\@@_define_code:w}
@@ -2154,8 +2162,8 @@
\@@_default_set:n { true }
\cs_if_exist:cF { if#1 }
{
- \cs:w newif \exp_after:wN \cs_end:
- \cs:w if#1 \cs_end:
+ \cs:w newif \exp_after:wN \cs_end:
+ \cs:w if#1 \cs_end:
}
}
% \end{macrocode}
@@ -3242,7 +3250,19 @@
{
\cs_if_exist:cTF
{ \c_@@_code_root_str \l_@@_module_str / unknown }
- { \@@_execute:no { \l_@@_module_str / unknown } \l_keys_value_tl }
+ {
+ \bool_if:NT \l_@@_no_value_bool
+ {
+ \cs_if_exist:cT
+ { \c_@@_default_root_str \l_@@_module_str / unknown }
+ {
+ \tl_set_eq:Nc
+ \l_keys_value_tl
+ { \c_@@_default_root_str \l_@@_module_str / unknown }
+ }
+ }
+ \@@_execute:no { \l_@@_module_str / unknown } \l_keys_value_tl
+ }
{
\msg_error:nnee { keys } { unknown }
\l_keys_path_str \l_@@_module_str