[latex3-commits] [git/LaTeX3-latex3-latex3] master: Just copy a bit of code that decides whether to brace clist items (28e3428)

Bruno Le Floch bruno at le-floch.fr
Tue Apr 3 04:43:50 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/28e3428a05d5cfae1edd158f269f6193886f208d

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

commit 28e3428a05d5cfae1edd158f269f6193886f208d
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Mon Apr 2 22:43:50 2018 -0400

    Just copy a bit of code that decides whether to brace clist items
    
    The code is simple enough and there isn't any reasonable interface


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

28e3428a05d5cfae1edd158f269f6193886f208d
 l3kernel/l3sort.dtx                     |   20 ++++++++++++++------
 l3kernel/testfiles/m3expl001.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl001.tlg        |    2 ++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.luatex.tlg |    2 ++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    2 ++
 l3kernel/testfiles/m3expl003.tlg        |    2 ++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    2 ++
 11 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/l3kernel/l3sort.dtx b/l3kernel/l3sort.dtx
index 868b728..28e884d 100644
--- a/l3kernel/l3sort.dtx
+++ b/l3kernel/l3sort.dtx
@@ -399,6 +399,7 @@
 % \begin{macro}
 %   {\clist_sort:Nn, \clist_sort:cn, \clist_gsort:Nn, \clist_gsort:cn}
 % \begin{macro}{\@@_clist:NNn}
+% \begin{macro}[EXP]{\@@_clist_wrap_item:n, \@@_clist_wrap_item:w}
 %   The case of empty comma-lists is a little bit special as usual,
 %   and filtered out: there is nothing to sort in that case.
 %   Otherwise, the input is done with \cs{clist_map_inline:Nn},
@@ -406,7 +407,7 @@
 %   for sequences and token lists. The first comma must be removed.
 %   An item must be wrapped in an extra set of braces if it contains
 %   either the space or the comma characters. This is taken care of
-%   by \cs{clist_wrap_item:n}, but \cs{@@_toks:NN} would simply
+%   by \cs{@@_clist_wrap_item:n}, but \cs{@@_toks:NN} would simply
 %   feed \cs{tex_the:D} \cs{tex_toks:D} \meta{number} as an
 %   argument to that function; hence we need to expand this argument
 %   once to unpack the register.
@@ -425,14 +426,23 @@
           \clist_map_inline:Nn \clist_map_break:n
           {
             \exp_last_unbraced:Nf \use_none:n
-              { \@@_toks:NN \exp_args:No \__clist_wrap_item:n }
+              { \@@_toks:NN \exp_args:No \@@_clist_wrap_item:n }
           }
           #2 {#3}
       }
   }
+\cs_new:Npn \@@_clist_wrap_item:n #1
+  {
+    ,
+    \tl_if_empty:oTF { \@@_clist_wrap_item:w #1 ~ , #1 ~ }
+      { \exp_not:n   {#1}   }
+      { \exp_not:n { {#1} } }
+  }
+\cs_new:Npn \@@_clist_wrap_item:w #1 , #2 ~ { }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@@_toks:NN, \@@_toks:NNw}
 %   Unpack the various \tn{toks} registers, from \cs{l_@@_min_int} to
@@ -443,10 +453,8 @@
 %     expanding to the \cs{__seq_item:n} separator, as expected;
 %   \item for token lists, they expand to nothing;
 %   \item for comma lists, they expand to \cs{exp_args:No}
-%     \cs{clist_wrap_item:n}, taking care of unpacking the register
-%     before letting the undocumented internal \pkg{clist} function
-%     \cs{clist_wrap_item:n} do the work of putting a comma and possibly
-%     braces.
+%     \cs{@@_clist_wrap_item:n}, taking care of unpacking the register
+%     before putting a comma and possibly braces.
 %   \end{itemize}
 %   For expansion behaviour we need a couple of primitives.
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 87c8ced..659282d 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -4670,6 +4670,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 79ce0ea..c4009b2 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 0cfb4ed..da6fc64 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index da3f9f9..0e07162 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index bd1757a..6c61ac9 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -4647,6 +4647,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 87c8ced..659282d 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -4670,6 +4670,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 79ce0ea..c4009b2 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 0cfb4ed..da6fc64 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index da3f9f9..0e07162 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -4607,6 +4607,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index bd1757a..6c61ac9 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -4647,6 +4647,8 @@ Defining \clist_gsort:Nn on line ...
 Defining \clist_sort:cn on line ...
 Defining \clist_gsort:cn on line ...
 Defining \__sort_clist:NNn on line ...
+Defining \__sort_clist_wrap_item:n on line ...
+Defining \__sort_clist_wrap_item:w on line ...
 Defining \__sort_toks:NN on line ...
 Defining \__sort_toks:NNw on line ...
 Defining \__sort_level: on line ...





More information about the latex3-commits mailing list