summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3keys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3keys.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3keys.dtx89
1 files changed, 75 insertions, 14 deletions
diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx
index e85bbc1d97..355de420bd 100644
--- a/macros/latex/contrib/l3kernel/l3keys.dtx
+++ b/macros/latex/contrib/l3kernel/l3keys.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-10-18}
+% \date{Released 2021-11-12}
%
% \maketitle
%
@@ -178,10 +178,10 @@
% \begin{function}[updated = 2013-07-08]
% {.bool_set:N, .bool_set:c, .bool_gset:N, .bool_gset:c}
% \begin{syntax}
-% \meta{key} .bool_set:N = \meta{boolean}
+% \meta{key} .bool_set:N = \meta{boolean variable}
% \end{syntax}
-% Defines \meta{key} to set \meta{boolean} to \meta{value} (which
-% must be either \texttt{true} or \texttt{false}). If the variable
+% Defines \meta{key} to set \meta{boolean variable} to \meta{value} (which
+% must be either \enquote{\texttt{true}} or \enquote{\texttt{false}}). If the variable
% does not exist, it will be created globally at the point that
% the key is set up.
% \end{function}
@@ -192,12 +192,12 @@
% .bool_gset_inverse:N, .bool_gset_inverse:c
% }
% \begin{syntax}
-% \meta{key} .bool_set_inverse:N = \meta{boolean}
+% \meta{key} .bool_set_inverse:N = \meta{boolean variable}
% \end{syntax}
-% Defines \meta{key} to set \meta{boolean} to the logical
-% inverse of \meta{value} (which must be either \texttt{true} or
-% \texttt{false}).
-% If the \meta{boolean} does not exist, it will be created globally
+% Defines \meta{key} to set \meta{boolean variable} to the logical
+% inverse of \meta{value} (which must be either \enquote{\texttt{true}} or
+% \enquote{\texttt{false}}).
+% If the \meta{boolean variable} does not exist, it will be created globally
% at the point that the key is set up.
% \end{function}
%
@@ -435,6 +435,27 @@
% require a value at point-of-use unless a default is set.
% \end{function}
%
+% \begin{function}[added = 2021-10-30]
+% {.str_set:N, .str_set:c, .str_gset:N, .str_gset:c}
+% \begin{syntax}
+% \meta{key} .str_set:N = \meta{string variable}
+% \end{syntax}
+% Defines \meta{key} to set \meta{string variable} to \meta{value}.
+% If the variable does not exist, it is created globally
+% at the point that the key is set up.
+% \end{function}
+%
+% \begin{function}[added = 2021-10-30]
+% {.str_set_x:N, .str_set_x:c, .str_gset_x:N, .str_gset_x:c}
+% \begin{syntax}
+% \meta{key} .str_set_x:N = \meta{string variable}
+% \end{syntax}
+% Defines \meta{key} to set \meta{string variable} to \meta{value},
+% which will be subjected to an \texttt{x}-type expansion
+% (\emph{i.e.}~using \cs{str_set:Nx}). If the variable does not exist,
+% it is created globally at the point that the key is set up.
+% \end{function}
+%
% \begin{function}{.tl_set:N, .tl_set:c, .tl_gset:N, .tl_gset:c}
% \begin{syntax}
% \meta{key} .tl_set:N = \meta{token list variable}
@@ -467,7 +488,7 @@
% \end{syntax}
% Specifies that \meta{key} cannot receive a \meta{value} when used.
% If a \meta{value} is given then an error will be issued. Setting
-% the property \texttt{false} cancels the restriction.
+% the property \enquote{\texttt{false}} cancels the restriction.
% \end{function}
%
% \begin{function}[added = 2015-07-14]{.value_required:n}
@@ -476,7 +497,7 @@
% \end{syntax}
% Specifies that \meta{key} must receive a \meta{value} when used.
% If a \meta{value} is not given then an error will be issued. Setting
-% the property \texttt{false} cancels the restriction.
+% the property \enquote{\texttt{false}} cancels the restriction.
% \end{function}
%
% \section{Sub-dividing keys}
@@ -1001,6 +1022,16 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\l__kernel_keyval_allow_blank_keys_bool}
+% The general behavior of the \pkg{l3keys} module is to throw an error on
+% blank key names. However to support the usage of \cs{keyval_parse:nnn} in
+% the \pkg{l3prop} module we allow this error to be switched off temporarily
+% and just ignore blank names.
+% \begin{macrocode}
+\bool_new:N \l__kernel_keyval_allow_blank_keys_bool
+% \end{macrocode}
+% \end{variable}
+%
% This temporary macro will be used since some of the definitions will need an
% active comma or equals sign. Inside of this macro |#1| will be the active
% comma and |#2| will be the active equals sign.
@@ -1343,9 +1374,11 @@
% \begin{macrocode}
\cs_new:Npn \@@_blank_true:w \s_@@_mark \s_@@_stop \@@_trim:nN #1 \@@_key:nn
{ \@@_loop_other:nnw }
-\cs_new:Npn \@@_blank_key_error:w #1 \@@_loop_other:nnw
+\cs_new:Npn \@@_blank_key_error:w \s_@@_mark \s_@@_stop #1 \@@_loop_other:nnw
{
- \msg_expandable_error:nn { keyval } { blank-key-name }
+ \bool_if:NTF \l__kernel_keyval_allow_blank_keys_bool
+ { #1 }
+ { \msg_expandable_error:nn { keyval } { blank-key-name } }
\@@_loop_other:nnw
}
% \end{macrocode}
@@ -2052,7 +2085,7 @@
}
{
\msg_error:nnx { keys }
- { property-boolean-values-only }
+ { boolean-values-only }
{ .value_ #1 :n }
}
}
@@ -2398,6 +2431,34 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{.str_set:N, .str_set:c}
+% \begin{macro}{.str_gset:N, .str_gset:c}
+% \begin{macro}{.str_set_x:N, .str_set_x:c}
+% \begin{macro}{.str_gset_x:N, .str_gset_x:c}
+% Setting a variable is very easy: just pass the data along.
+% \begin{macrocode}
+\cs_new_protected:cpn { \c_@@_props_root_str .str_set:N } #1
+ { \@@_variable_set:NnnN #1 { str } { } n }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_set:c } #1
+ { \@@_variable_set:cnnN {#1} { str } { } n }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_set_x:N } #1
+ { \@@_variable_set:NnnN #1 { str } { } x }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_set_x:c } #1
+ { \@@_variable_set:cnnN {#1} { str } { } x }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_gset:N } #1
+ { \@@_variable_set:NnnN #1 { str } { g } n }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_gset:c } #1
+ { \@@_variable_set:cnnN {#1} { str } { g } n }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_gset_x:N } #1
+ { \@@_variable_set:NnnN #1 { str } { g } x }
+\cs_new_protected:cpn { \c_@@_props_root_str .str_gset_x:c } #1
+ { \@@_variable_set:cnnN {#1} { str } { g } x }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{.tl_set:N, .tl_set:c}
% \begin{macro}{.tl_gset:N, .tl_gset:c}
% \begin{macro}{.tl_set_x:N, .tl_set_x:c}