summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-19 22:49:13 +0000
committerKarl Berry <karl@freefriends.org>2012-01-19 22:49:13 +0000
commit17d590a6bcf898806aeec2d7aa57d641a440ca10 (patch)
treedd82ac37aed8f78a0eca38ab7b5c1250b6585fef /Master/texmf-dist/source/latex/l3kernel/l3clist.dtx
parent2648c52105e48119c27762f885fefa29d172b38b (diff)
l3kernel 3209 (19jan12)
git-svn-id: svn://tug.org/texlive/trunk@25157 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3clist.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3clist.dtx93
1 files changed, 51 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx
index e04b2227944..ade1e0cedc4 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx
@@ -2,6 +2,7 @@
%
%% File: l3clist.dtx Copyright (C) 2004-2011 Frank Mittelbach,
%% The LaTeX3 project
+%% (C) 2012 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -36,7 +37,7 @@
%
%<*driver|package>
\RequirePackage{l3names}
-\GetIdInfo$Id: l3clist.dtx 3086 2011-12-22 17:55:46Z bruno $
+\GetIdInfo$Id: l3clist.dtx 3157 2012-01-09 00:42:07Z bruno $
{L3 Experimental comma separated lists}
%</driver|package>
%<*driver>
@@ -211,8 +212,8 @@
% \begin{syntax}
% \cs{clist_use:N} \meta{comma list}
% \end{syntax}
-% Places the \meta{comma list} directly into the input stream, thus
-% treating it as a \meta{token list}.
+% Places the \meta{comma list} directly into the input stream,
+% including the commas, thus treating it as a \meta{token list}.
% \end{function}
%
% \section{Modifying comma lists}
@@ -527,7 +528,7 @@
% \emph{i.e.}~every item in a \meta{comma list} is unique.
% \end{function}
%
-% \begin{function}[updated = 2011-09-06, EXP]
+% \begin{function}[updated = 2012-01-08, EXP]
% {\clist_item:Nn, \clist_item:cn, \clist_item:nn}
% \begin{syntax}
% \cs{clist_item:Nn} \meta{comma list} \Arg{integer expression}
@@ -540,6 +541,12 @@
% is larger than the number of items in the \meta{comma list} (as
% calculated by \cs{clist_length:N}) then the function will expand to
% nothing.
+% \begin{texnote}
+% The result is returned within the \tn{unexpanded}
+% primitive (\cs{exp_not:n}), which means that the \meta{item}
+% will not expand further when appearing in an x-type
+% argument expansion.
+% \end{texnote}
% \end{function}
%
% \begin{function}[updated = 2011-08-31]
@@ -616,11 +623,11 @@
%</package>
% \end{macrocode}
%
-% \begin{variable}{\l_clist_tmpa_clist}
+% \begin{variable}{\l_clist_internal_clist}
% Scratch space for various internal uses. This comma list variable
% cannot be declared as such because it comes before \cs{clist_new:N}
% \begin{macrocode}
-\tl_new:N \l_clist_tmpa_clist
+\tl_new:N \l_clist_internal_clist
% \end{macrocode}
% \end{variable}
%
@@ -850,8 +857,8 @@
{ \clist_put_left_aux:NNNn \clist_gconcat:NNN \clist_set:Nn }
\cs_new_protected:Npn \clist_put_left_aux:NNNn #1#2#3#4
{
- #2 \l_clist_tmpa_clist {#4}
- #1 #3 \l_clist_tmpa_clist #3
+ #2 \l_clist_internal_clist {#4}
+ #1 #3 \l_clist_internal_clist #3
}
\cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx }
@@ -886,8 +893,8 @@
{ \clist_put_right_aux:NNNn \clist_gconcat:NNN \clist_gset:Nn }
\cs_new_protected:Npn \clist_put_right_aux:NNNn #1#2#3#4
{
- #2 \l_clist_tmpa_clist {#4}
- #1 #3 #3 \l_clist_tmpa_clist
+ #2 \l_clist_internal_clist {#4}
+ #1 #3 #3 \l_clist_internal_clist
}
\cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx }
\cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx }
@@ -994,10 +1001,10 @@
%
% \subsection{Modifying comma lists}
%
-% \begin{variable}{\l_clist_remove_clist}
+% \begin{variable}{\l_clist_internal_remove_clist}
% An internal comma list for the removal routines.
% \begin{macrocode}
-\clist_new:N \l_clist_remove_clist
+\clist_new:N \l_clist_internal_remove_clist
% \end{macrocode}
% \end{variable}
%
@@ -1014,13 +1021,13 @@
{ \clist_remove_duplicates_aux:NN \clist_gset_eq:NN }
\cs_new_protected:Npn \clist_remove_duplicates_aux:NN #1#2
{
- \clist_clear:N \l_clist_remove_clist
+ \clist_clear:N \l_clist_internal_remove_clist
\clist_map_inline:Nn #2
{
- \clist_if_in:NnF \l_clist_remove_clist {##1}
- { \clist_put_right:Nn \l_clist_remove_clist {##1} }
+ \clist_if_in:NnF \l_clist_internal_remove_clist {##1}
+ { \clist_put_right:Nn \l_clist_internal_remove_clist {##1} }
}
- #1 #2 \l_clist_remove_clist
+ #1 #2 \l_clist_internal_remove_clist
}
\cs_generate_variant:Nn \clist_remove_duplicates:N { c }
\cs_generate_variant:Nn \clist_gremove_duplicates:N { c }
@@ -1098,13 +1105,6 @@
%
% \subsection{Comma list conditionals}
%
-% \begin{variable}{\l_clist_if_in_clist}
-% An internal comma list for \cs{clist_if_in:nn} conditionals.
-% \begin{macrocode}
-\clist_new:N \l_clist_if_in_clist
-% \end{macrocode}
-% \end{variable}
-%
% \begin{macro}[pTF]{\clist_if_empty:N, \clist_if_empty:c}
% \UnitTested
% Simple copies from the token list variable material.
@@ -1143,8 +1143,8 @@
}
\prg_new_protected_conditional:Npnn \clist_if_in:nn #1#2 { T , F , TF }
{
- \clist_set:Nn \l_clist_if_in_clist {#1}
- \exp_args:No \clist_if_in_return:nn \l_clist_if_in_clist {#2}
+ \clist_set:Nn \l_clist_internal_clist {#1}
+ \exp_args:No \clist_if_in_return:nn \l_clist_internal_clist {#2}
}
\cs_new_protected:Npn \clist_if_in_return:nn #1#2
{
@@ -1260,8 +1260,8 @@
}
\cs_new_protected:Npn \clist_map_inline:nn #1
{
- \clist_set:Nn \l_clist_tmpa_clist {#1}
- \clist_map_inline:Nn \l_clist_tmpa_clist
+ \clist_set:Nn \l_clist_internal_clist {#1}
+ \clist_map_inline:Nn \l_clist_internal_clist
}
\cs_generate_variant:Nn \clist_map_inline:Nn { c }
% \end{macrocode}
@@ -1291,8 +1291,8 @@
}
\cs_new_protected:Npn \clist_map_variable:nNn #1
{
- \clist_set:Nn \l_clist_tmpa_clist {#1}
- \clist_map_variable:NNn \l_clist_tmpa_clist
+ \clist_set:Nn \l_clist_internal_clist {#1}
+ \clist_map_variable:NNn \l_clist_internal_clist
}
\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3,
{
@@ -1335,11 +1335,11 @@
}
\cs_new_protected:Npn \clist_show:n #1
{
- \clist_set:Nn \l_clist_tmpa_clist {#1}
+ \clist_set:Nn \l_clist_internal_clist {#1}
\msg_aux_show:Nnx
- \l_clist_tmpa_clist
+ \l_clist_internal_clist
{ clist }
- { \clist_map_function:NN \l_clist_tmpa_clist \msg_aux_show:n }
+ { \clist_map_function:NN \l_clist_internal_clist \msg_aux_show:n }
}
\cs_generate_variant:Nn \clist_show:N { c }
% \end{macrocode}
@@ -1440,7 +1440,7 @@
\cs_new:Npn \clist_item_N_loop:nw #1 #2,
{
\int_compare:nNnTF {#1} = \c_zero
- { \use_i_delimit_by_q_stop:nw {#2} }
+ { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } }
{ \exp_args:Nf \clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } }
}
\cs_generate_variant:Nn \clist_item:Nn { c }
@@ -1489,7 +1489,7 @@
\exp_after:wN \exp_after:wN \exp_after:wN \clist_item_n_strip:w
\tl_trim_spaces:n {#1} ,
}
-\cs_new:Npn \clist_item_n_strip:w #1 , {#1}
+\cs_new:Npn \clist_item_n_strip:w #1 , { \exp_not:n {#1} }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1506,6 +1506,8 @@
% \clist_gset_from_seq:Nc, \clist_gset_from_seq:cc
% }
% \UnitTested
+% \begin{macro}[aux]{\clist_set_from_seq_aux:NNNN}
+% \begin{macro}[aux]{\clist_wrap_item:n}
% Setting a comma list from a comma-separated list is done using a simple
% mapping. We wrap most items with \cs{exp_not:n}, and a comma. Items which
% contain a comma or a space are surrounded by an extra set of braces. The
@@ -1520,17 +1522,20 @@
\seq_if_empty:NTF #4
{ #1 #3 }
{
- \seq_push_item_def:n
+ #2 #3
{
- ,
- \tl_if_empty:oTF { \clist_set_from_seq_aux:w ##1 ~ , ##1 ~ }
- { \exp_not:n {##1} }
- { \exp_not:n { {##1} } }
+ \exp_last_unbraced:Nf \use_none:n
+ { \seq_map_function:NN #4 \clist_wrap_item:n }
}
- #2 #3 { \exp_last_unbraced:Nf \use_none:n #4 }
- \seq_pop_item_def:
}
}
+\cs_new:Npn \clist_wrap_item:n #1
+ {
+ ,
+ \tl_if_empty:oTF { \clist_set_from_seq_aux:w #1 ~ , #1 ~ }
+ { \exp_not:n {#1} }
+ { \exp_not:n { {#1} } }
+ }
\cs_new:Npn \clist_set_from_seq_aux:w #1 , #2 ~ { }
\cs_generate_variant:Nn \clist_set_from_seq:NN { Nc }
\cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc }
@@ -1539,6 +1544,8 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}
% {
@@ -1624,7 +1631,7 @@
% \end{macrocode}
% \end{macro}
%
-% Deprecated on 2011-09-05, for removal by 2011-12-32.
+% Deprecated on 2011-09-05, for removal by 2011-12-31.
%
% \begin{macro}
% {
@@ -1636,10 +1643,12 @@
% The \cs{clist_trim_spaces:n} function is now internal,
% deprecated for use outside the kernel.
% \begin{macrocode}
+%<*deprecated>
\cs_new_protected:Npn \clist_trim_spaces:N #1 { \clist_set:No #1 {#1} }
\cs_new_protected:Npn \clist_gtrim_spaces:N #1 { \clist_gset:No #1 {#1} }
\cs_generate_variant:Nn \clist_trim_spaces:N { c }
\cs_generate_variant:Nn \clist_gtrim_spaces:N { c }
+%</deprecated>
% \end{macrocode}
% \end{macro}
%