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.dtx125
1 files changed, 56 insertions, 69 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
index 75dcff129dd..7b8c19097ba 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
@@ -41,7 +41,7 @@
% }^^A
% }
%
-% \date{Released 2018/03/05}
+% \date{Released 2018-04-30}
%
% \maketitle
%
@@ -118,7 +118,7 @@
%
% \section{Creating keys}
%
-% \begin{function}[updated = 2015-11-07]{\keys_define:nn}
+% \begin{function}[updated = 2017-11-14]{\keys_define:nn}
% \begin{syntax}
% \cs{keys_define:nn} \Arg{module} \Arg{keyval list}
% \end{syntax}
@@ -343,9 +343,9 @@
% \meta{key} .meta:n = \Arg{keyval list}
% \end{syntax}
% Makes \meta{key} a meta-key, which will set \meta{keyval list} in
-% one go. If \meta{key} is given with a value at the time the key
-% is used, then the value will be passed through to the subsidiary
-% \meta{keys} for processing (as |#1|).
+% one go. The \meta{keyval list} can refer as |#1| to the value given
+% at the time the \meta{key} is used (or, if no value is given, the
+% \meta{key}'s default value).
% \end{function}
%
% \begin{function}[added = 2013-07-10]{.meta:nn}
@@ -353,10 +353,10 @@
% \meta{key} .meta:nn = \Arg{path} \Arg{keyval list}
% \end{syntax}
% Makes \meta{key} a meta-key, which will set \meta{keyval list} in
-% one go using the \meta{path} in place of the current one.
-% If \meta{key} is given with a value at the time the key
-% is used, then the value will be passed through to the subsidiary
-% \meta{keys} for processing (as |#1|).
+% one go using the \meta{path} in place of the current one. The
+% \meta{keyval list} can refer as |#1| to the value given at the time
+% the \meta{key} is used (or, if no value is given, the \meta{key}'s
+% default value).
% \end{function}
%
% \begin{function}[added = 2011-08-21]{.multichoice:}
@@ -598,7 +598,7 @@
%
% \section{Setting keys}
%
-% \begin{function}[updated = 2015-11-07]
+% \begin{function}[updated = 2017-11-14]
% {\keys_set:nn, \keys_set:nV, \keys_set:nv, \keys_set:no}
% \begin{syntax}
% \cs{keys_set:nn} \Arg{module} \Arg{keyval list}
@@ -757,7 +757,7 @@
%
% \section{Utility functions for keys}
%
-% \begin{function}[EXP, pTF, updated = 2015-11-07]{\keys_if_exist:nn}
+% \begin{function}[EXP, pTF, updated = 2017-11-14]{\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}
@@ -766,7 +766,7 @@
% has been defined for \meta{key}.
% \end{function}
%
-% \begin{function}[added = 2011-08-21,EXP,pTF, updated = 2015-11-07]
+% \begin{function}[added = 2011-08-21,EXP,pTF, updated = 2017-11-14]
% {\keys_if_choice_exist:nnn}
% \begin{syntax}
% \cs{keys_if_choice_exist_p:nnn} \Arg{module} \Arg{key} \Arg{choice} \\
@@ -913,9 +913,7 @@
% The main function starts off by normalising category codes in package mode.
% That's relatively \enquote{expensive} so is skipped (hopefully) in format
% mode. We then hand off to the parser. The use of \cs{q_mark} here prevents
-% loss of braces from the key argument. This particular quark is chosen as
-% it fits in with \cs{__tl_trim_spaces:nn} and allows a performance enhancement
-% as the token can be carried through. Notice that by passing the two
+% loss of braces from the key argument. Notice that by passing the two
% processor commands along the input stack we avoid the need to track these
% at all.
% \begin{macrocode}
@@ -1043,7 +1041,9 @@
\if_meaning:w \l_@@_key_tl \c_empty_tl
\exp_after:wN \@@_split_tidy:w
\else:
- \exp_after:wN \@@_split_value:NNw \exp_after:wN #1 \exp_after:wN #2
+ \exp_after:wN \@@_split_value:NNw
+ \exp_after:wN #1
+ \exp_after:wN #2
\exp_after:wN \q_mark
\fi:
}
@@ -1053,7 +1053,9 @@
\cs_set:Npx \@@_action:
{ \exp_not:N #1 { \exp_not:o \l_@@_key_tl } }
\else:
- \if:w \scan_stop: \etex_detokenize:D \exp_after:wN { \use_none:n #4 }
+ \if:w
+ \scan_stop:
+ \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #4 }
\scan_stop:
\@@_def:Nn \l_@@_value_tl {#3}
\cs_set:Npx \@@_action:
@@ -1064,14 +1066,19 @@
}
\else:
\cs_set:Npn \@@_action:
- { \__kernel_msg_error:nn { kernel } { misplaced-equals-sign } }
+ {
+ \__kernel_msg_error:nn { kernel }
+ { misplaced-equals-sign }
+ }
\fi:
\fi:
\@@_action:
}
\cs_new_protected:Npn \@@_split_tidy:w #1 \q_stop
{
- \if:w \scan_stop: \etex_detokenize:D \exp_after:wN { \use_none:n #1 }
+ \if:w
+ \scan_stop:
+ \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #1 }
\scan_stop:
\else:
\exp_after:wN \@@_empty_key:
@@ -1088,15 +1095,16 @@
% \begin{macro}{\@@_def:Nn}
% \begin{macro}[EXP]{\@@_def_aux:n}
% \begin{macro}[EXP]{\@@_def_aux:w}
-% First trim spaces off, then potentially remove a set of braces. By using
-% the internal interface |\__tl_trim_spaces:nn| we can take advantage of the
-% fact it needs a leading |\q_mark| in this process. The |\exp_after:wN|
-% removes the quark, the delimited argument deals with any braces.
+% First remove the leading quark, then trim spaces off, and finally remove
+% a set of braces.
% \begin{macrocode}
\cs_new_protected:Npn \@@_def:Nn #1#2
- { \tl_set:Nx #1 { \__tl_trim_spaces:nn {#2} \@@_def_aux:n } }
+ {
+ \tl_set:Nx #1
+ { \tl_trim_spaces_apply:oN { \use_none:n #2 } \@@_def_aux:n }
+ }
\cs_new:Npn \@@_def_aux:n #1
- { \exp_after:wN \@@_def_aux:w #1 \q_stop }
+ { \@@_def_aux:w #1 \q_stop }
\cs_new:Npn \@@_def_aux:w #1 \q_stop { \exp_not:n {#1} }
% \end{macrocode}
% \end{macro}
@@ -1295,7 +1303,7 @@
{
\tl_if_empty:NF \l_@@_property_tl
{
- \__kernel_msg_error:nnxx { kernel } { property-unknown }
+ \__kernel_msg_error:nnxx { kernel } { key-property-unknown }
{ \l_@@_property_tl } { \l_keys_path_tl }
}
}
@@ -1314,7 +1322,8 @@
\cs_new_protected:Npn \@@_property_find:n #1
{
\tl_set:Nx \l_@@_property_tl { \@@_remove_spaces:n {#1} }
- \exp_after:wN \@@_property_find:w \l_@@_property_tl . . \q_stop {#1}
+ \exp_after:wN \@@_property_find:w \l_@@_property_tl . .
+ \q_stop {#1}
}
\cs_new_protected:Npn \@@_property_find:w #1 . #2 . #3 \q_stop #4
{
@@ -1373,18 +1382,15 @@
{ \use:c { \c_@@_props_root_tl \l_@@_property_tl } }
{
\__kernel_msg_error:nnxx { kernel }
- { property-requires-value } { \l_@@_property_tl }
+ { key-property-requires-value } { \l_@@_property_tl }
{ \l_keys_path_tl }
}
}
{ \use:c { \c_@@_props_root_tl \l_@@_property_tl } {#1} }
}
-\use:x
- {
- \cs_new:Npn \exp_not:N \__keys_define_code:w
- ##1 \c_colon_str ##2 \exp_not:N \q_stop
- }
- { \tl_if_empty:nTF {#2} }
+\exp_last_unbraced:NNNNo
+ \cs_new:Npn \__keys_define_code:w #1 \c_colon_str #2 \q_stop
+ { \tl_if_empty:nTF {#2} }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1454,7 +1460,10 @@
{ \c_@@_type_root_tl \@@_parent:o \l_keys_path_tl }
{
\str_if_eq_x:nnTF
- { \exp_not:v { \c_@@_type_root_tl \@@_parent:o \l_keys_path_tl } }
+ {
+ \exp_not:v
+ { \c_@@_type_root_tl \@@_parent:o \l_keys_path_tl }
+ }
{ choice }
{
\__kernel_msg_error:nnxx { kernel } { nested-choice-key }
@@ -1466,7 +1475,8 @@
}
\cs_new_protected:Npn \@@_choice_make_aux:N #1
{
- \cs_set_nopar:cpn { \c_@@_type_root_tl \l_keys_path_tl } { choice }
+ \cs_set_nopar:cpn { \c_@@_type_root_tl \l_keys_path_tl }
+ { choice }
\@@_cmd_set:nn { \l_keys_path_tl } { #1 {##1} }
\@@_cmd_set:nn { \l_keys_path_tl / unknown }
{
@@ -1495,7 +1505,8 @@
\clist_map_inline:nn {#2}
{
\int_incr:N \l_keys_choice_int
- \@@_cmd_set:nx { \l_keys_path_tl / \@@_remove_spaces: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
@@ -1658,7 +1669,8 @@
}
}
{
- \__kernel_msg_error:nnx { kernel } { property-boolean-values-only }
+ \__kernel_msg_error:nnx { kernel }
+ { key-property-boolean-values-only }
{ .value_ #1 :n }
}
}
@@ -2332,7 +2344,8 @@
}
}
{
- \cs_if_exist:cTF { \c_@@_code_root_tl \l_@@_module_tl / unknown }
+ \cs_if_exist:cTF
+ { \c_@@_code_root_tl \l_@@_module_tl / unknown }
{
\cs:w \c_@@_code_root_tl \l_@@_module_tl / unknown
\exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl }
@@ -2458,7 +2471,10 @@
\exp_args:Nnf \msg_show_item_unbraced:nn { code }
{
\exp_args:Nc \token_get_replacement_spec:N
- { \c_@@_code_root_tl \@@_remove_spaces:n { #2 / #3 } }
+ {
+ \c_@@_code_root_tl
+ \@@_remove_spaces:n { #2 / #3 }
+ }
}
}
}
@@ -2480,15 +2496,6 @@
The~key~'#1'~only~accepts~predefined~values,~
and~'#2'~is~not~one~of~these.
}
-\__kernel_msg_new:nnnn { kernel } { key-no-property }
- { No~property~given~in~definition~of~key~'#1'. }
- {
- \c__msg_coding_error_text_tl
- Inside~\keys_define:nn each~key~name~
- needs~a~property: \\ \\
- \iow_indent:n { #1 .<property> } \\ \\
- LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property.
- }
\__kernel_msg_new:nnnn { kernel } { key-unknown }
{ The~key~'#1'~is~unknown~and~is~being~ignored. }
{
@@ -2501,26 +2508,6 @@
The~key~'#1'~cannot~be~defined~as~a~choice~as~the~parent~key~'#2'~is~
itself~a~choice.
}
-\__kernel_msg_new:nnnn { kernel } { property-boolean-values-only }
- { The~property~'#1'~accepts~boolean~values~only. }
- {
- \c__msg_coding_error_text_tl
- The~property~'#1'~only~accepts~the~values~'true'~and~'false'.
- }
-\__kernel_msg_new:nnnn { kernel } { property-requires-value }
- { The~property~'#1'~requires~a~value. }
- {
- \c__msg_coding_error_text_tl
- LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\
- No~value~was~given~for~the~property,~and~one~is~required.
- }
-\__kernel_msg_new:nnnn { kernel } { property-unknown }
- { The~key~property~'#1'~is~unknown. }
- {
- \c__msg_coding_error_text_tl
- LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~
- this~property~is~not~defined.
- }
\__kernel_msg_new:nnnn { kernel } { value-forbidden }
{ The~key~'#1'~does~not~take~a~value. }
{