diff --git a/base/changes.txt b/base/changes.txt index 66f76188a..ed2c58483 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -5,6 +5,11 @@ hotfixes). It is provided for convenience only. It therefore makes no claims to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ + +2024-10-07 Joseph Wright + * lttemplates.dtx + Correct passing of token list content using \KeyValue + 2024-10-02 Ulrike Fischer * lttagging.dtx: restore also paratagging in the para/restore socket, see https://github.com/latex3/tagging-project/issues/723 @@ -17,7 +22,6 @@ not part of the distribution. * lttagging.dtx: declare tagging sockets for floats and caption. 2024-09-15 Joseph Wright - * lttemplates-doc.tex, lttemplates-code.tex: New files * clsguide.tex diff --git a/base/lttemplates.dtx b/base/lttemplates.dtx index a25fac9dc..d247d3755 100644 --- a/base/lttemplates.dtx +++ b/base/lttemplates.dtx @@ -2098,30 +2098,43 @@ % \end{macro} % % \begin{macro}{\@@_assign_variable:} -% \begin{macro}{\@@_assign_variable:N, \@@_assign_variable:c} +% \begin{macro}{\@@_assign_variable:n} % A general-purpose function for all of the other assignments. % As long as the value is not coming from another variable, the stored -% value is simply transferred for output. +% value is simply transferred for output. We use \texttt{V}-type expansion +% for the \cs{KeyValue} case: for token lists this is essential, whilst +% for register-based variables, it does no harm and avoids needing a +% low-level test. % \begin{macrocode} \cs_new_protected:Npn \@@_assign_variable: { - \@@_assign_variable:c + \exp_args:Ne \@@_assign_variable:n { - \@@_map_var_type: _ - \bool_if:NT \l_@@_global_bool { g } set:Nn + \@@_map_var_type: + _ + \bool_if:NT \l_@@_global_bool { g } + set:N } } -\cs_new_protected:Npn \@@_assign_variable:N #1 +\cs_new_protected:Npn \@@_assign_variable:n #1 { - \@@_if_key_value:VT \l_@@_value_tl - { \@@_key_to_value: } - \tl_put_right:Ne \l_@@_assignments_tl + \@@_if_key_value:VTF \l_@@_value_tl { - #1 \exp_not:V \l_@@_var_tl - { \exp_not:V \l_@@_value_tl } + \@@_key_to_value: + \tl_put_right:Ne \l_@@_assignments_tl + { + \exp_not:c { #1 V } \exp_not:V \l_@@_var_tl + \exp_not:V \l_@@_value_tl + } + } + { + \tl_put_right:Ne \l_@@_assignments_tl + { + \exp_not:c { #1 n } \exp_not:V \l_@@_var_tl + { \exp_not:V \l_@@_value_tl } + } } } -\cs_generate_variant:Nn \@@_assign_variable:N { c } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/base/testfiles-lttemplates/lttemplates005.lvt b/base/testfiles-lttemplates/lttemplates005.lvt index 5243dc85d..ee85f8a95 100644 --- a/base/testfiles-lttemplates/lttemplates005.lvt +++ b/base/testfiles-lttemplates/lttemplates005.lvt @@ -52,17 +52,20 @@ dim-b : length = \KeyValue { dim-a } , tl-a : tokenlist = abc , tl-b : tokenlist = \KeyValue { tl-a } , + tl-c : tokenlist = \KeyValue { tl-a } , } \DeclareTemplateCode { test } { std2 } { 0 } { dim-a = global \g_tmpa_dim , dim-b = \l_tmpb_dim , tl-a = \l_tmpa_tl , - tl-b = \l_tmpb_tl + tl-b = \l_tmpb_tl , + tl-c = \l_tmpa_tl } { \typeout { \dim_use:N \l_tmpb_dim } \typeout { \tl_use:N \l_tmpb_tl } + \typeout { \tl_use:N \l_tmpa_tl } } \DeclareInstance { test } { run } { std2 } { } diff --git a/base/testfiles-lttemplates/lttemplates005.tlg b/base/testfiles-lttemplates/lttemplates005.tlg index 20d83e71d..7b5478e4c 100644 --- a/base/testfiles-lttemplates/lttemplates005.tlg +++ b/base/testfiles-lttemplates/lttemplates005.tlg @@ -16,6 +16,7 @@ TEST 2: Key values with global ============================================================ 10.0pt abc +abc ============================================================ ============================================================ TEST 3: Key values for booleans