diff --git a/base/changes.txt b/base/changes.txt index 04ad4c708..35a396959 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -13,6 +13,12 @@ not part of the distribution. Document more prominently that using a hook with \UseHook or similar commands requires that the hook to be declared first (gh/1519) +2025-02-01 Jonathan P. Spratte + + * ltcmd.dtx (subsection{User functions}): + Generalise \ProcessList by using \tl_map_tokens:nn instead of + \tl_map_function:nN. + 2025-01-31 Frank Mittelbach * latexrelease.dtx (subsection{Ignoring \texttt{\string_new} errors when rolling back}): diff --git a/base/doc/usrguide.tex b/base/doc/usrguide.tex index bb47ea997..280c05dec 100644 --- a/base/doc/usrguide.tex +++ b/base/doc/usrguide.tex @@ -43,7 +43,7 @@ \texttt{usrguide.tex} for full details.}% } -\date{2025-01-24} +\date{2025-02-01} \NewDocumentCommand\cs{m}{\texttt{\textbackslash\detokenize{#1}}} \NewDocumentCommand\marg{m}{\arg{#1}} @@ -668,15 +668,21 @@ \subsection{Argument processors} \end{verbatim} \begin{decl} - |\ProcessList| \arg{list} \arg{cmd} + |\ProcessList| \arg{list} \arg{tokens} \end{decl} To support \cs{SplitList}, the function \cs{ProcessList} is available -to apply a \meta{cmd} to every entry in a \meta{list}. The -\meta{cmd} should absorb one argument: the list entry. For example +to apply \meta{tokens} to every entry in a \meta{list}. The +\meta{tokens} can be arbitrary contents that should expect one argument +after it: the list entry. For example \begin{verbatim} \NewDocumentCommand \foo {>{\SplitList{;}} m} {\ProcessList{#1}{\SomeDocumentCommand}} \end{verbatim} +or +\begin{verbatim} +\NewDocumentCommand \foo {>{\SplitList{;}} m} + {\ProcessList{#1}{Abc \SomeDocumentCommand}} +\end{verbatim} \begin{decl} |\ReverseBoolean| diff --git a/base/ltcmd.dtx b/base/ltcmd.dtx index acb9aac3b..928e9d89d 100644 --- a/base/ltcmd.dtx +++ b/base/ltcmd.dtx @@ -34,8 +34,8 @@ %%% From File: ltcmd.dtx % % \begin{macrocode} -\def\ltcmdversion{v1.3a} -\def\ltcmddate{2025-01-24} +\def\ltcmdversion{v1.3b} +\def\ltcmddate{2025-02-01} % \end{macrocode} % %<*driver> @@ -5706,8 +5706,10 @@ % % \begin{macro}{\ProcessList} % To support \cs{SplitList}. +% \changes{v1.3b}{2025-02-01} +% {Use \cs{tl_map_tokens:nn} instead of \cs{tl_map_function:nN}} % \begin{macrocode} -\cs_new_eq:NN \ProcessList \tl_map_function:nN +\cs_new_eq:NN \ProcessList \tl_map_tokens:nn % \end{macrocode} % \end{macro} % diff --git a/base/testfiles-ltcmd/ltcmd004.luatex.tlg b/base/testfiles-ltcmd/ltcmd004.luatex.tlg index e8939aa26..e333b3f14 100644 --- a/base/testfiles-ltcmd/ltcmd004.luatex.tlg +++ b/base/testfiles-ltcmd/ltcmd004.luatex.tlg @@ -609,3 +609,13 @@ TEST 31: Processor depending on other argument |{a}{bcd;e}|1| |{a,bcd}{e}|1| ============================================================ +============================================================ +TEST 32: ProcessList +============================================================ +a +b,c +|a|ARG| +||ARG| +|b,c|ARG| +|\empty |ARG| +============================================================ diff --git a/base/testfiles-ltcmd/ltcmd004.lvt b/base/testfiles-ltcmd/ltcmd004.lvt index e6e41116b..b04effeba 100644 --- a/base/testfiles-ltcmd/ltcmd004.lvt +++ b/base/testfiles-ltcmd/ltcmd004.lvt @@ -518,4 +518,15 @@ \foo { a , bcd ; e } [;] } +\TEST { ProcessList } + { + \DeclareDocumentCommand \foo { >{\SplitList{,}}m } + { \ProcessList{#1}{\TYPE} } + \foo{a,,{b,c}} + \NewDocumentCommand \fooAux { m m } { \TYPE { \tl_to_str:n { |#2|#1| } } } + \DeclareDocumentCommand \foo { >{\SplitList{,}}m m } + { \ProcessList{#1}{\fooAux{#2}} } + \foo{a,,{b,c},\empty}{ARG} + } + \END diff --git a/base/testfiles-ltcmd/ltcmd004.tlg b/base/testfiles-ltcmd/ltcmd004.tlg index ffb9ca773..9da187fdf 100644 --- a/base/testfiles-ltcmd/ltcmd004.tlg +++ b/base/testfiles-ltcmd/ltcmd004.tlg @@ -609,3 +609,13 @@ TEST 31: Processor depending on other argument |{a}{bcd;e}|1| |{a,bcd}{e}|1| ============================================================ +============================================================ +TEST 32: ProcessList +============================================================ +a +b,c +|a|ARG| +||ARG| +|b,c|ARG| +|\empty |ARG| +============================================================