diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3keys.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 71 |
1 files changed, 56 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index d8745a856f5..d29b7134957 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 5684 2015-07-26 07:23:48Z joseph $ +\GetIdInfo$Id: l3keys.dtx 5869 2015-08-20 01:19:17Z bruno $ {L3 Key-value interfaces} %</driver|package> %<*driver> @@ -134,7 +134,7 @@ % \l_mymodule_tmp_tl .code:n = code % } % \end{verbatim} -% will create a key called \cs{l_mymodule_tmp_tl}, and not one called +% will create a key called |\l_mymodule_tmp_tl|, and not one called % \texttt{key}. % % \section{Creating keys} @@ -778,12 +778,12 @@ % itself is not defined. % \end{function} % -% \begin{function}{\keys_show:nn} +% \begin{function}[updated = 2015-08-09]{\keys_show:nn} % \begin{syntax} % \cs{keys_show:nn} \Arg{module} \Arg{key} % \end{syntax} -% Shows the function which is used to actually implement a -% \meta{key} for a \meta{module}. +% Shows the information associated to the \meta{key} for a \meta{module}, +% including the function which is used to actually implement it. % \end{function} % % \section{Low-level interface for parsing key--val lists} @@ -1314,9 +1314,9 @@ % |\cs_set_protected:cpn| not |\cs_new_protected:cpn| here. For the % same reason, to avoid issues if the key has been undefined in the % current scope but exists at a higher level, we do not use \cs{prop_new:c} -% but rather \cs{prop_set_eq:cN}. The use of \cs{__chk_if_free_cs:c} -% ensures that when logging of all new functions is active, keys -% still show up (as we are not using \cs{..._new}). +% but rather \cs{prop_set_eq:cN}. The function \cs{__chk_log:x} only +% writes to the log file if logging all new functions is active: without +% it keys would not show up (as we are not using \cs{..._new}). % \begin{macrocode} \cs_new_protected:Npn \@@_ensure_exist:n #1 { @@ -1326,7 +1326,7 @@ } \cs_if_exist:cF { \c_@@_code_root_tl #1 } { - \__chk_if_free_cs:c { \c_@@_code_root_tl #1 } + \__chk_log:x { Defining~key~#1~ \msg_line_context: } \cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 { } } } @@ -1413,7 +1413,7 @@ \cs_new_protected_nopar:Npn \@@_choice_make_aux:N #1 { \@@_cmd_set:nn { \l_keys_path_tl } { #1 {##1} } - \prop_put:cnn { \c__keys_info_root_tl \l_keys_path_tl } { choice } + \prop_put:cnn { \c_@@_info_root_tl \l_keys_path_tl } { choice } { true } \@@_cmd_set:nn { \l_keys_path_tl / unknown } { @@ -2278,12 +2278,46 @@ % \end{macro} % % \begin{macro}{\keys_show:nn} -% Showing a key is just a question of using the correct name. +% \begin{macro}[aux]{\@@_show:NN} +% To show a key, test for its existence to issue the correct message +% (same message, but with a |t| or |f| argument, then build the +% control sequences which contain the code and other information +% about the key, call an intermediate auxiliary which constructs the +% code that will be displayed to the terminal, and finally conclude +% with \cs{__msg_show_wrap:n}. % \begin{macrocode} \cs_new_protected:Npn \keys_show:nn #1#2 - { \cs_show:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } } + { + \keys_if_exist:nnTF {#1} {#2} + { + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key } + { \tl_to_str: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 } } + } + { + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-key } + { \tl_to_str:n { #1 / #2 } } { f } { } { } + \__msg_show_wrap:n { } + } + } +\cs_new_protected:Npn \@@_show:NN #1#2 + { + \use:x + { + \__msg_show_wrap:n + { + \exp_not:N \__msg_show_item_unbraced:nn { code } + { \token_get_replacement_spec:N #1 } + \exp_not:n + { \prop_map_function:NN #2 \__msg_show_item_unbraced:nn } + } + } + } % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Messages} % @@ -2316,7 +2350,7 @@ \__msg_kernel_new:nnnn { kernel } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { - The~module~'#2'~does~not~have~a~key~called~#1'.\\ + The~module~'#2'~does~not~have~a~key~called~'#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \__msg_kernel_new:nnnn { kernel } { nested-choice-key } @@ -2346,10 +2380,10 @@ this~property~is~not~defined. } \__msg_kernel_new:nnnn { kernel } { value-forbidden } - { The~key~'#1'~does~not~taken~a~value. } + { The~key~'#1'~does~not~take~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ - LaTeX~will~ignore~the~given~value~'#2'. + The~value~'#2'~was~present:~the~key~will~be~ignored. } \__msg_kernel_new:nnnn { kernel } { value-required } { The~key~'#1'~requires~a~value. } @@ -2357,6 +2391,13 @@ The~key~'#1'~must~have~a~value.\\ No~value~was~present:~the~key~will~be~ignored. } +\__msg_kernel_new:nnn { kernel } { show-key } + { + The~key~#1~ + \str_if_eq:nnTF {#2} { t } + { has~the~properties: } + { is~undefined. } + } % \end{macrocode} % % \subsection{Deprecated functions} |