summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-20 23:00:54 +0000
committerKarl Berry <karl@freefriends.org>2015-12-20 23:00:54 +0000
commitf4e67bebe6f832d21491cfa7ae1dfa9388899117 (patch)
tree3ecab4ba208e0c7ef72957758d26a48d8fc008b8 /Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
parent01185308aa1c1a77c8926a0432aeda02d7a240d9 (diff)
l3 (20dec15)
git-svn-id: svn://tug.org/texlive/trunk@39152 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3keys.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3keys.dtx72
1 files changed, 50 insertions, 22 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
index 1f9f6b537a4..7b834f6c7a7 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3keys.dtx 6037 2015-09-23 12:41:15Z joseph $
+\GetIdInfo$Id: l3keys.dtx 6284 2015-11-17 10:10:56Z bruno $
{L3 Key-value interfaces}
%</driver|package>
%<*driver>
@@ -122,7 +122,8 @@
% \end{verbatim}
%
% Key names may contain any tokens, as they are handled internally
-% using \cs{tl_to_str:n}. As will be discussed in
+% using \cs{tl_to_str:n}; spaces are \emph{ignored} in key names.
+% As will be discussed in
% section~\ref{sec:l3keys:subdivision}, it is suggested that the character
% |/| is reserved for sub-division of keys into logical
% groups. Functions and variables are \emph{not} expanded when creating
@@ -139,7 +140,7 @@
%
% \section{Creating keys}
%
-% \begin{function}{\keys_define:nn}
+% \begin{function}[updated = 2015-11-07]{\keys_define:nn}
% \begin{syntax}
% \cs{keys_define:nn} \Arg{module} \Arg{keyval list}
% \end{syntax}
@@ -599,7 +600,7 @@
%
% \section{Setting keys}
%
-% \begin{function}
+% \begin{function}[updated = 2015-11-07]
% {\keys_set:nn, \keys_set:nV, \keys_set:nv, \keys_set:no}
% \begin{syntax}
% \cs{keys_set:nn} \Arg{module} \Arg{keyval list}
@@ -656,7 +657,7 @@
% }
% \end{verbatim}
%
-% \begin{function}[added = 2011-08-23, updated = 2014-04-27]
+% \begin{function}[added = 2011-08-23, updated = 2015-11-07]
% {
% \keys_set_known:nnN, \keys_set_known:nVN,
% \keys_set_known:nvN, \keys_set_known:noN,
@@ -720,7 +721,7 @@
% groups to be made \enquote{active}, or by marking one or more groups to
% be ignored in key setting.
%
-% \begin{function}[added = 2013-07-14, updated = 2014-04-27]
+% \begin{function}[added = 2013-07-14, updated = 2015-11-07]
% {
% \keys_set_filter:nnnN, \keys_set_filter:nnVN,
% \keys_set_filter:nnvN, \keys_set_filter:nnoN,
@@ -742,7 +743,7 @@
% \meta{keyval list} returned at each stage.
% \end{function}
%
-% \begin{function}[added = 2013-07-14]
+% \begin{function}[added = 2013-07-14, updated = 2015-11-07]
% {
% \keys_set_groups:nnn, \keys_set_groups:nnV,
% \keys_set_groups:nnv, \keys_set_groups:nno
@@ -758,7 +759,7 @@
%
% \section{Utility functions for keys}
%
-% \begin{function}[EXP,pTF]{\keys_if_exist:nn}
+% \begin{function}[EXP, pTF, updated = 2015-11-07]{\keys_if_exist:nn}
% \begin{syntax}
% \cs{keys_if_exist_p:nn} \Arg{module} \Arg{key} \\
% \cs{keys_if_exist:nnTF} \Arg{module} \Arg{key} \Arg{true code} \Arg{false code}
@@ -767,7 +768,8 @@
% has been defined for \meta{key}.
% \end{function}
%
-% \begin{function}[added = 2011-08-21,EXP,pTF]{\keys_if_choice_exist:nnn}
+% \begin{function}[added = 2011-08-21,EXP,pTF, updated = 2015-11-07]
+% {\keys_if_choice_exist:nnn}
% \begin{syntax}
% \cs{keys_if_choice_exist_p:nnn} \Arg{module} \Arg{key} \Arg{choice} \\
% \cs{keys_if_choice_exist:nnnTF} \Arg{module} \Arg{key} \Arg{choice} \Arg{true code} \Arg{false code}
@@ -1200,7 +1202,7 @@
{ \@@_define:onn \l_@@_module_tl }
\cs_new_protected:Npn \@@_define:nnn #1#2#3
{
- \tl_set:Nx \l_@@_module_tl { \tl_to_str:n {#2} }
+ \tl_set:Nx \l_@@_module_tl { \@@_remove_spaces:n {#2} }
\keyval_parse:NNn \@@_define_elt:n \@@_define_elt:nn {#3}
\tl_set:Nn \l_@@_module_tl {#1}
}
@@ -1263,7 +1265,11 @@
}
\cs_new_protected:Npn \@@_property_find:w #1 . #2 \q_stop
{
- \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} }
+ \tl_set:Nx \l_keys_path_tl
+ {
+ \l_keys_path_tl
+ \@@_remove_spaces:n {#1}
+ }
\tl_if_in:nnTF {#2} { . }
{
\tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . }
@@ -1455,7 +1461,7 @@
\clist_map_inline:nn {#2}
{
\int_incr:N \l_keys_choice_int
- \@@_cmd_set:nx { \l_keys_path_tl / \tl_to_str:n {##1} }
+ \@@_cmd_set:nx { \l_keys_path_tl / \@@_remove_spaces:n {##1} }
{
\tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
\int_set:Nn \exp_not:N \l_keys_choice_int
@@ -1907,7 +1913,7 @@
{ \@@_set:onn { \l_@@_module_tl } }
\cs_new_protected:Npn \@@_set:nnn #1#2#3
{
- \tl_set:Nx \l_@@_module_tl { \tl_to_str:n {#2} }
+ \tl_set:Nx \l_@@_module_tl { \@@_remove_spaces:n {#2} }
\keyval_parse:NNn \@@_set_elt:n \@@_set_elt:nn {#3}
\tl_set:Nn \l_@@_module_tl {#1}
}
@@ -2040,7 +2046,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_elt_aux:nnn #1#2#3
{
- \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / \tl_to_str:n {#2} }
+ \tl_set:Nx \l_keys_path_tl
+ { \l_@@_module_tl / \@@_remove_spaces:n {#2} }
\tl_clear:N \l_@@_module_tl
\exp_after:wN \@@_find_key_module:w \l_keys_path_tl / \q_stop
\@@_value_or_default:n {#3}
@@ -2241,7 +2248,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_choice_find:n #1
{
- \@@_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} }
+ \@@_execute:nn { \l_keys_path_tl / \@@_remove_spaces:n {#1} }
{ \@@_execute:nn { \l_keys_path_tl / unknown } { } }
}
\cs_new:Npn \@@_multichoice_find:n #1
@@ -2252,12 +2259,32 @@
%
% \subsection{Utilities}
%
+% \begin{macro}[EXP, int]{\@@_remove_spaces:n}
+% \begin{macro}[EXP, aux]{\@@_remove_spaces:w}
+% Removes all spaces from the input which is detokenized as a result.
+% This function has the same effect as \tn{zap@space} in \LaTeXe{}
+% after applying \cs{tl_to_str:n}. It is set up to be fast as the
+% use case here is tightly defined. The~|?| is only there to allow
+% for a space after \cs{use_none:nn} responsible for ending the loop.
+% \begin{macrocode}
+\cs_new:Npn \@@_remove_spaces:n #1
+ {
+ \exp_after:wN \@@_remove_spaces:w \tl_to_str:n {#1}
+ \use_none:nn ? ~
+ }
+\cs_new:Npn \@@_remove_spaces:w #1 ~
+ { #1 \@@_remove_spaces:w }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}[EXP,pTF]{\keys_if_exist:nn}
-% A utility for others to see if a key exists.
+% A utility for others to see if a key exists.
% \begin{macrocode}
\prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF }
{
- \cs_if_exist:cTF { \c_@@_code_root_tl \tl_to_str:n { #1 / #2 } }
+ \cs_if_exist:cTF
+ { \c_@@_code_root_tl \@@_remove_spaces:n { #1 / #2 } }
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -2270,7 +2297,8 @@
\prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3
{ p , T , F , TF }
{
- \cs_if_exist:cTF { \c_@@_code_root_tl \tl_to_str:n { #1 / #2 / #3 } }
+ \cs_if_exist:cTF
+ { \c_@@_code_root_tl \@@_remove_spaces:n { #1 / #2 / #3 } }
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -2291,14 +2319,14 @@
\keys_if_exist:nnTF {#1} {#2}
{
\__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key }
- { \tl_to_str:n { #1 / #2 } } { t } { } { }
+ { \@@_remove_spaces:n { #1 / #2 } } { t } { } { }
\exp_args:Ncc \@@_show:NN
- { \c_@@_code_root_tl \tl_to_str:n { #1 / #2 } }
- { \c_@@_info_root_tl \tl_to_str:n { #1 / #2 } }
+ { \c_@@_code_root_tl \@@_remove_spaces:n { #1 / #2 } }
+ { \c_@@_info_root_tl \@@_remove_spaces:n { #1 / #2 } }
}
{
\__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key }
- { \tl_to_str:n { #1 / #2 } } { f } { } { }
+ { \@@_remove_spaces:n { #1 / #2 } } { f } { } { }
\__msg_show_wrap:n { }
}
}