From a4ccc84b5ea15905a51f24c56989a29267cfd949 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 13 Nov 2021 03:01:22 +0000 Subject: CTAN sync 202111130301 --- macros/latex/contrib/l3kernel/l3prop.dtx | 113 +++++++++++-------------------- 1 file changed, 39 insertions(+), 74 deletions(-) (limited to 'macros/latex/contrib/l3kernel/l3prop.dtx') diff --git a/macros/latex/contrib/l3kernel/l3prop.dtx b/macros/latex/contrib/l3kernel/l3prop.dtx index df20a5c02c..ca6f9a3467 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-10-18} +% \date{Released 2021-11-12} % % \maketitle % @@ -52,10 +52,10 @@ % \LaTeX3 implements a \enquote{property list} data type, which contain % an unordered list of entries each of which consists of a \meta{key} and % an associated \meta{value}. The \meta{key} and \meta{value} may both -% be any \meta{balanced text}, but the \meta{key} is processed using -% \cs{tl_to_str:n}, meaning that category codes are ignored. It is -% possible to map functions to property lists such that the function is -% applied to every key--value pair within the list. +% be any \meta{balanced text}, the \meta{key} is processed using +% \cs{tl_to_str:n}, meaning that category codes are ignored. It is possible to +% map functions to property lists such that the function is applied to every +% key--value pair within the list. % % Each entry in a property list must have a unique \meta{key}: if an entry is % added to a property list which already contains the \meta{key} then the new @@ -111,7 +111,7 @@ % \meta{property list_2}. % \end{function} % -% \begin{function}[added = 2017-11-28, updated = 2019-08-25] +% \begin{function}[added = 2017-11-28, updated = 2021-11-07] % { % \prop_set_from_keyval:Nn, \prop_set_from_keyval:cn, % \prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn, @@ -131,9 +131,11 @@ % group then a set of outer braces is removed. This enables both the % \meta{key} and the \meta{value} to contain spaces, commas or equal % signs. The \meta{key} is then processed by \cs{tl_to_str:n}. +% This function correctly detects the |=| and |,| signs provided they +% have the standard category code~$12$ or they are active. % \end{function} % -% \begin{function}[added = 2017-11-28, updated = 2019-08-25] +% \begin{function}[added = 2017-11-28, updated = 2021-11-07] % {\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} % \begin{syntax} % \cs{prop_const_from_keyval:Nn} \meta{prop~var} @@ -147,6 +149,8 @@ % contain key--value pairs given in the second argument, processed in % the way described for \cs{prop_set_from_keyval:Nn}. If duplicate % keys appear only the last of the values is kept. +% This function correctly detects the |=| and |,| signs provided they +% have the standard category code~$12$ or they are active. % \end{function} % % \section{Adding and updating property list entries} @@ -205,7 +209,7 @@ % last value, namely the value in \meta{prop~var_3} is kept. % \end{function} % -% \begin{function}[added = 2021-05-16] +% \begin{function}[added = 2021-05-16, updated = 2021-11-07] % { % \prop_put_from_keyval:Nn, \prop_put_from_keyval:cn, % \prop_gput_from_keyval:Nn, \prop_gput_from_keyval:cn, @@ -230,6 +234,8 @@ % \cs{prop_concat:NNN}. In particular, the \meta{keys} and % \meta{values} are space-trimmed and unbraced as described in % \cs{prop_set_from_keyval:Nn}. +% This function correctly detects the |=| and |,| signs provided they +% have the standard category code~$12$ or they are active. % \end{function} % % \section{Recovering values from property lists} @@ -793,7 +799,7 @@ \cs_new_protected:Npn \@@_concat:NNNN #1#2#3#4 { \prop_set_eq:NN \l_@@_internal_prop #3 - \prop_map_tokens:Nn #4 { \prop_put:Nnn \l_@@_internal_prop } + \prop_map_inline:Nn #4 { \prop_put:Nnn \l_@@_internal_prop {##1} {##2} } #1 #2 \l_@@_internal_prop } % \end{macrocode} @@ -804,16 +810,7 @@ % \begin{macro}{\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} % \begin{macro}{\prop_put_from_keyval:Nn, \prop_put_from_keyval:cn} % \begin{macro}{\prop_gput_from_keyval:Nn, \prop_gput_from_keyval:cn} -% \begin{macro} -% { -% \@@_from_keyval:n, -% \@@_from_keyval_loop:w, -% \@@_from_keyval_split:Nw, -% \@@_from_keyval_key:n, -% \@@_from_keyval_key:w, -% \@@_from_keyval_value:n, -% \@@_from_keyval_value:w -% } +% \begin{macro}{\@@_missing_eq:n} % To avoid tracking throughout the loop the variable name and whether % the assignment is local/global, do everything in a scratch variable % and empty it afterwards to avoid wasting memory. Loop through items @@ -832,80 +829,48 @@ % output one key--value pair for the property list; otherwise complain % about a missing or extra~|=|. % \begin{macrocode} -\cs_new_protected:Npn \prop_set_from_keyval:Nn #1#2 +\cs_new_protected:Npn \prop_set_from_keyval:Nn #1 { - \prop_clear:N \l_@@_internal_prop - \@@_from_keyval:n {#2} - \prop_set_eq:NN #1 \l_@@_internal_prop - \prop_clear:N \l_@@_internal_prop + \prop_clear:N #1 + \prop_put_from_keyval:Nn #1 } \cs_generate_variant:Nn \prop_set_from_keyval:Nn { c } -\cs_new_protected:Npn \prop_gset_from_keyval:Nn #1#2 +\cs_new_protected:Npn \prop_gset_from_keyval:Nn #1 { - \prop_clear:N \l_@@_internal_prop - \@@_from_keyval:n {#2} - \prop_gset_eq:NN #1 \l_@@_internal_prop - \prop_clear:N \l_@@_internal_prop + \prop_gclear:N #1 + \prop_gput_from_keyval:Nn #1 } \cs_generate_variant:Nn \prop_gset_from_keyval:Nn { c } \cs_new_protected:Npn \prop_const_from_keyval:Nn #1#2 { - \prop_clear:N \l_@@_internal_prop - \@@_from_keyval:n {#2} + \prop_set_from_keyval:Nn \l_@@_internal_prop {#2} \tl_const:Nx #1 { \exp_not:o \l_@@_internal_prop } \prop_clear:N \l_@@_internal_prop } \cs_generate_variant:Nn \prop_const_from_keyval:Nn { c } -\cs_new_protected:Npn \prop_put_from_keyval:Nn #1#2 +\cs_new_protected:Npn \prop_put_from_keyval:Nn { - \prop_set_eq:NN \l_@@_internal_prop #1 - \@@_from_keyval:n {#2} - \prop_set_eq:NN #1 \l_@@_internal_prop - \prop_clear:N \l_@@_internal_prop + \bool_if:NTF \l__kernel_keyval_allow_blank_keys_bool + { \@@_keyval_parse:NNNn \c_true_bool } + { \@@_keyval_parse:NNNn \c_false_bool } + \prop_put:Nnn } \cs_generate_variant:Nn \prop_put_from_keyval:Nn { c } -\cs_new_protected:Npn \prop_gput_from_keyval:Nn #1#2 +\cs_new_protected:Npn \prop_gput_from_keyval:Nn { - \prop_set_eq:NN \l_@@_internal_prop #1 - \@@_from_keyval:n {#2} - \prop_gset_eq:NN #1 \l_@@_internal_prop - \prop_clear:N \l_@@_internal_prop + \bool_if:NTF \l__kernel_keyval_allow_blank_keys_bool + { \@@_keyval_parse:NNNn \c_true_bool } + { \@@_keyval_parse:NNNn \c_false_bool } + \prop_gput:Nnn } \cs_generate_variant:Nn \prop_gput_from_keyval:Nn { c } -\cs_new_protected:Npn \@@_from_keyval:n #1 - { - \@@_from_keyval_loop:w \prg_do_nothing: #1 , - \q_@@_recursion_tail , \q_@@_recursion_stop - } -\cs_new_protected:Npn \@@_from_keyval_loop:w #1 , - { - \@@_if_recursion_tail_stop:o {#1} - \@@_from_keyval_split:Nw \@@_from_keyval_key:n - #1 = = \s_@@_stop {#1} - \@@_from_keyval_loop:w \prg_do_nothing: - } -\cs_new_protected:Npn \@@_from_keyval_split:Nw #1#2 = - { \tl_trim_spaces_apply:oN {#2} #1 } -\cs_new_protected:Npn \@@_from_keyval_key:n #1 - { \@@_from_keyval_key:w #1 \s_@@_mark } -\cs_new_protected:Npn \@@_from_keyval_key:w #1 \s_@@_mark #2 \s_@@_stop +\cs_new_protected:Npn \@@_missing_eq:n + { \msg_error:nnn { prop } { prop-keyval } } +\cs_new_protected:Npn \@@_keyval_parse:NNNn #1#2#3#4 { - \@@_from_keyval_split:Nw \@@_from_keyval_value:n - \prg_do_nothing: #2 \s_@@_stop {#1} - } -\cs_new_protected:Npn \@@_from_keyval_value:n #1 - { \@@_from_keyval_value:w #1 \s_@@_mark } -\cs_new_protected:Npn \@@_from_keyval_value:w #1 \s_@@_mark #2 \s_@@_stop #3#4 - { - \tl_if_single:nTF {#2} - { \prop_put:Nnn \l_@@_internal_prop {#3} {#1} } - { - \tl_if_empty:nF { #3 #1 #2 } - { - \msg_error:nnx { prop } { prop-keyval } - { \exp_not:o {#4} } - } - } + \bool_set_eq:NN \l__kernel_keyval_allow_blank_keys_bool \c_true_bool + \keyval_parse:nnn \@@_missing_eq:n { #2 #3 } {#4} + \bool_set_eq:NN \l__kernel_keyval_allow_blank_keys_bool #1 } % \end{macrocode} % \end{macro} -- cgit v1.2.3