From 92ffb9032b85f818a8d3b469ad4d3889c2a44ba1 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 17 May 2023 03:01:58 +0000 Subject: CTAN sync 202305170301 --- macros/latex/contrib/l3kernel/l3prop.dtx | 69 ++++++++------------------------ 1 file changed, 17 insertions(+), 52 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 297fcd877f..341b46bdff 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-05-11} +% \date{Released 2023-05-15} % % \maketitle % @@ -1087,66 +1087,31 @@ % have to make sure that the behaviour is as good as possible. Using a space % before the opening brace we get the correct brace stripping behaviour for % most of the key--value parsers available in \LaTeX. -% If \cs{tex_expanded:D} is available this function makes use of it, so there -% are two different implementations here. They both start with -% \cs{__kernel_exp_not:w} to start the expansion context to expand in two -% steps. If the \meta{property list} is empty they just leave an empty set of -% braces in the input stream for \cs{__kernel_exp_not:w}. -% \begin{macrocode} -\cs_if_exist:NTF \tex_expanded:D - { -% \end{macrocode} -% The variant using \cs{tex_expanded:D} can just iterate over the +% Iterate over the % \meta{property list} and remove the leading comma afterwards. Only the value % has to be protected in \cs{__kernel_exp_not:w} as the property name is % always a string. After the loop the leading comma is removed by % \cs{use_none:n} and afterwards \cs{__kernel_exp_not:w} eventually finds the % opening brace of its argument. % \begin{macrocode} - \cs_new:Npn \prop_to_keyval:N #1 - { - \__kernel_exp_not:w - \prop_if_empty:NTF #1 - { {} } - { - \exp_after:wN \exp_after:wN \exp_after:wN +\cs_new:Npn \prop_to_keyval:N #1 + { + \__kernel_exp_not:w + \prop_if_empty:NTF #1 + { {} } + { + \exp_after:wN \exp_after:wN \exp_after:wN + { + \tex_expanded:D { - \tex_expanded:D - { - \__kernel_exp_not:w { \use_none:n } - \prop_map_function:NN #1 \@@_to_keyval:nn - } + \__kernel_exp_not:w { \use_none:n } + \prop_map_function:NN #1 \@@_to_keyval:nn } - } - } - \cs_new:Npn \@@_to_keyval:nn #1#2 - { , ~ {#1} =~ { \__kernel_exp_not:w {#2} } } - } -% \end{macrocode} -% The other variant will iterate over the \meta{property list} and has to -% output the result in a group after the marker -% \cs{@@_to_keyval_exp_after:wN}. As a result this is considerably slower than -% the \cs{tex_expanded:D} using variant as it has to read the entire contents -% of the \meta{property list} for each item. Since the marker is just -% \cs{exp_after:wN} with another name, after the loop the leading comma is -% gobbled by \cs{use_none:n}, leaving the result as the argument to -% \cs{__kernel_exp_not:w}. -% \begin{macrocode} - { - \cs_new:Npn \prop_to_keyval:N #1 - { - \__kernel_exp_not:w - \prop_if_empty:NTF #1 - { {} } - { - \prop_map_function:NN #1 \@@_to_keyval:nnw - \@@_to_keyval_exp_after:wN { \use_none:n } - } - } - \cs_new_eq:NN \@@_to_keyval_exp_after:wN \exp_after:wN - \cs_new:Npn \@@_to_keyval:nnw #1#2#3 \@@_to_keyval_exp_after:wN #4 - { #3 \@@_to_keyval_exp_after:wN { #4 , ~ {#1} =~ {#2} } } + } + } } +\cs_new:Npn \@@_to_keyval:nn #1#2 + { , ~ {#1} =~ { \__kernel_exp_not:w {#2} } } % \end{macrocode} % \end{macro} % \end{macro} -- cgit v1.2.3