[latex3-commits] [git/LaTeX3-latex3-latex3] main: Retain spaces in xtemplate key names (369d36d97)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue May 24 22:49:56 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/369d36d974ebf6e932df21542cc5016b47297a4f

>---------------------------------------------------------------

commit 369d36d974ebf6e932df21542cc5016b47297a4f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue May 24 21:49:56 2022 +0100

    Retain spaces in xtemplate key names
    
    This matches l3keys, pgfkeys, etc.


>---------------------------------------------------------------

369d36d974ebf6e932df21542cc5016b47297a4f
 l3packages/xtemplate/xtemplate.dtx | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index 987e20b6d..a2293af29 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -686,6 +686,10 @@
   {L3 Experimental prototype document functions}
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\cs_generate_variant:Nn \tl_trim_spaces:n { e }
+%    \end{macrocode}
+%
 % \subsection{Variables and constants}
 %
 % \begin{variable}{\c_@@_code_root_tl}
@@ -1305,8 +1309,8 @@
 % \begin{macro}{\@@_split_keytype:n}
 % \begin{macro}{\@@_split_keytype_aux:w}
 %   The keytype and key name should be separated by |:|. As the
-%   definition might be given inside or outside of a code block, spaces
-%   are removed and the category code of colons is standardised. After
+%   definition might be given inside or outside of a code block,
+%   the category code of colons is standardised. After
 %   that, the standard delimited argument method is used to separate the
 %   two parts.
 %    \begin{macrocode}
@@ -1314,7 +1318,6 @@
   {
     \exp_not:N \bool_set_false:N \exp_not:N \l_@@_error_bool
     \tl_set:Nn \exp_not:N \l_@@_tmp_tl {#1}
-    \tl_remove_all:Nn \exp_not:N \l_@@_tmp_tl { ~ }
     \tl_replace_all:Nnn \exp_not:N \l_@@_tmp_tl { : } { \token_to_str:N : }
     \tl_if_in:onTF \exp_not:N \l_@@_tmp_tl { \token_to_str:N : }
       {
@@ -1336,7 +1339,10 @@
       ##1 \token_to_str:N : ##2 \s_@@_stop
       {
         \tl_put_right:Nx \exp_not:N \l_@@_key_name_tl
-          { \exp_not:N \tl_to_str:n {##1} }
+          {
+            \exp_not:N \tl_trim_spaces:e
+              { \exp_not:N \tl_to_str:n {##1} }
+          }
         \tl_if_in:nnTF {##2} { \token_to_str:N : }
           {
             \tl_put_right:Nn \exp_not:N \l_@@_key_name_tl
@@ -1562,8 +1568,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parse_vars_elt:nn #1#2
  {
-    \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} }
-    \tl_remove_all:Nn \l_@@_key_name_tl { ~ }
+    \tl_set:Nx \l_@@_key_name_tl
+      { \tl_trim_spaces:e { \tl_to_str:n {#1} } }
     \prop_get:NoNTF
       \l_@@_keytypes_prop
       \l_@@_key_name_tl
@@ -1849,8 +1855,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parse_values_elt:nn #1#2
   {
-    \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} }
-    \tl_remove_all:Nn \l_@@_key_name_tl { ~ }
+    \tl_set:Nx \l_@@_key_name_tl
+      { \tl_trim_spaces:e { \tl_to_str:n {#1} } }
     \prop_get:NoNTF \l_@@_keytypes_prop \l_@@_key_name_tl
       \l_@@_tmp_tl
       {
@@ -2351,8 +2357,7 @@
   { \exp_after:wN \@@_key_to_value_auxi:w \l_@@_value_tl }
 \cs_new_protected:Npn \@@_key_to_value_auxi:w \KeyValue #1
   {
-    \tl_set:Nx \l_@@_tmp_tl { \tl_to_str:n {#1} }
-    \tl_remove_all:Nn \l_@@_key_name_tl { ~ }
+    \tl_set:Nx \l_@@_tmp_tl { \tl_trim_spaces:e { \tl_to_str:n {#1} } }
     \prop_get:NoNTF
       \l_@@_vars_prop
       \l_@@_tmp_tl





More information about the latex3-commits mailing list.