texlive[69284] Master/texmf-dist: collargs (3jan24)
commits+karl at tug.org
commits+karl at tug.org
Wed Jan 3 22:18:30 CET 2024
Revision: 69284
https://tug.org/svn/texlive?view=revision&revision=69284
Author: karl
Date: 2024-01-03 22:18:30 +0100 (Wed, 03 Jan 2024)
Log Message:
-----------
collargs (3jan24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/generic/collargs/FILES
trunk/Master/texmf-dist/doc/generic/collargs/README.md
trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
trunk/Master/texmf-dist/source/generic/collargs/collargs.ins
trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex
trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
Added Paths:
-----------
trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md
Added: trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md 2024-01-03 21:18:30 UTC (rev 69284)
@@ -0,0 +1,25 @@
+# CollArgs changelog
+
+This package was developed as an auxiliary package of
+[Memoize](https://ctan.org/pkg/memoize), and is documented alongside that
+package. Note, however, that the Memoize manual, `memoize-doc.pdf`, is not
+reissued for patch-level releases of CollArgs; the version of the Memoize manual
+fully applicable to the particular version of CollArgs is indicated at each
+version.
+
+Whenever the date of the Memoize manual is older than the release date of a
+particular version of CollArgs, the documented source of CollArgs shown in that
+version of `memoize-code.pdf` of course does not reflect the latest changes; in
+those cases, please see [Memoize's GitHub
+repository](https://github.com/sasozivanovic/memoize) for the recent
+development history.
+
+## 2024/01/02 v1.1.0
+* Implement `brace collected`.
+
+Manual: Memoize 2024/01/02 v1.1.0
+
+## 2023/10/10 v1.0.0
+* The initial release.
+
+Manual: Memoize 2023/10/10 v1.0.0
Property changes on: trunk/Master/texmf-dist/doc/generic/collargs/CHANGELOG.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/generic/collargs/FILES
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/FILES 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/doc/generic/collargs/FILES 2024-01-03 21:18:30 UTC (rev 69284)
@@ -1,9 +1,10 @@
doc/generic/collargs/LICENCE
doc/generic/collargs/INSTALL.md
+doc/generic/collargs/CHANGELOG.md
doc/generic/collargs/FILES
doc/generic/collargs/README.md
tex/latex/collargs/collargs.sty
-tex/context/collargs/t-collargs.tex
+tex/context/third/collargs/t-collargs.tex
tex/plain/collargs/collargs.tex
source/generic/collargs/collargs.edtx
source/generic/collargs/Makefile
Modified: trunk/Master/texmf-dist/doc/generic/collargs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/README.md 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/doc/generic/collargs/README.md 2024-01-03 21:18:30 UTC (rev 69284)
@@ -6,3 +6,14 @@
[Memoize](https://ctan.org/pkg/memoize). This is why it is, somewhat
unconventionally, documented alongside that package. This applies to both the
manual and the documented code listing.
+
+# LICENCE
+
+This work may be distributed and/or modified under the conditions of the LaTeX
+Project Public License, either version 1.3c of this license or (at your option)
+any later version. The latest version of this license is in
+https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all
+distributions of LaTeX version 2008 or later.
+
+This work has the LPPL maintenance status `maintained'. The Current Maintainer
+of this work is Sašo Živanović (saso.zivanovic at guest.arnes.si).
Modified: trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx 2024-01-03 21:18:30 UTC (rev 69284)
@@ -10,11 +10,11 @@
%% (Sa\v{s}o \v{Z}ivanovi\'{c})
%%
%% This work may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this license or (at your
-%% option) any later version. The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
-%% all distributions of LaTeX version 2005/12/01 or later.
-%%
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
+%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
%%
@@ -46,14 +46,14 @@
%
%
% \paragraph{Identification}
-%<latex>\ProvidesPackage{collargs}[2023/10/10 v1.0.0 Collect arguments of any command]
+%<latex>\ProvidesPackage{collargs}[2024/01/02 v1.1.0 Collect arguments of any command]
%<context>%D \module[
%<context>%D file=t-collargs.tex,
-%<context>%D version=1.0.0,
+%<context>%D version=1.1.0,
%<context>%D title=CollArgs,
%<context>%D subtitle=Collect arguments of any command,
%<context>%D author=Saso Zivanovic,
-%<context>%D date=2023-10-10,
+%<context>%D date=2024-01-02,
%<context>%D copyright=Saso Zivanovic,
%<context>%D license=LPPL,
%<context>%D ]
@@ -70,24 +70,38 @@
%<plain>\catcode`\@11\relax
%
% \begin{macro}{\toksapp,\gtoksapp,\etoksapp,\xtoksapp}
-% Our macros for appending to a token register only accept a control sequence
-% defined by |\toksdef| (like |\mytoks|) but not an explicit register
-% designation like |\toks0|, so we only define them if noone else did; the
-% names of the macros match the \hologo{LuaTeX} primitives, so they surely
-% won't be defined there.
-\ifdefined\toksapp\else
- \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+% Macros for appending to a token register. We don't have to define them in
+% \hologo{LuaTeX}, where they exist as primitives. Same as these primitives,
+% out macros accept either a register number or a |\toksdef|fed control
+% sequence as the (unbraced) |#1|; |#2| is the text to append.
+\ifdefined\luatexversion
+\else
+ \def\toksapp{\toks at cs@or at num\@toksapp}
+ \def\gtoksapp{\toks at cs@or at num\@gtoksapp}
+ \def\etoksapp{\toks at cs@or at num\@etoksapp}
+ \def\xtoksapp{\toks at cs@or at num\@xtoksapp}
+ \def\toks at cs@or at num#1#2#{%
+ % Test whether |#2| (the original |#1|) is a number or a control sequence.
+ \ifnum-2>-1#2
+ % It is a number. |\toks at cs@or at num@num| will gobble |\toks at cs@or at num@cs|
+ % below.
+ \expandafter\toks at cs@or at num@num
+ % The register control sequence in |#2| is skipped over in the false
+ % branch.
+ \fi
+ \toks at cs@or at num@cs{#1}{#2}%
+ }
+ % |#1| is one of |\@toksapp| and friends. The second macro prefixes the
+ % register number by |\toks|.
+ \def\toks at cs@or at num@cs#1#2{#1{#2}}
+ \def\toks at cs@or at num@num\toks at cs@or at num@cs#1#2{#1{\toks#2 }}
+ % Having either |\tokscs| or |\toks<number>| in |#1|, we can finally do the
+ % real job.
+ \long\def\@toksapp#1#2{#1\expandafter{\the#1#2}}%
+ \long\def\@etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+ \long\def\@gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+ \long\def\@xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
\fi
-\ifdefined\etoksapp\else
- \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\gtoksapp\else
- \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
-\fi
-\ifdefined\xtoksapp\else
- \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\toks@\else\toksdef\toks@=0 \fi
% \end{macro}
%
% \begin{macro}{\CollectArguments,\CollectArgumentsRaw}
@@ -521,7 +535,19 @@
\newif\ifcollargsNoDelimiters
% \end{macro}
% \end{collargskey}
-%
+
+% \begin{collargskey}{brace collected}
+% \begin{macro}{\ifcollargsBraceCollected}
+% When this conditional is set to false, the collected arguments are not
+% enclosed in braces when passed on to \meta{next-code}.
+\collargsSet{%
+ brace collected/.is if=collargsBraceCollected,
+}
+\newif\ifcollargsBraceCollected
+\collargsBraceCollectedtrue
+% \end{macro}
+% \end{collargskey}
+%
% \subsubsection{The central loop}
% \label{sec:code:collargs:central-loop}
%
@@ -678,7 +704,12 @@
\expanded{%
\endgroup
\noexpand\collargs at fix{%
- \expandonce\collargs at next{\the\collargs at toks}%
+ \expandonce\collargs at next
+ \ifcollargsBraceCollected
+ {\the\collargs at toks}%
+ \else
+ \the\collargs at toks
+ \fi
\collargs at spaces
}%
}%
@@ -1680,7 +1711,7 @@
\collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
% Assign the collected tokens into a register. The first token in |##1|
% will be |\collargs at empty|, so we expand to get rid of it.
- \expandafter\toks@\expandafter{##1}%
+ \toks0\expandafter{##1}%
% |cprotect| simply grabs the token following the |\collargs at begintag| with
% a parameter. We can't do this, because we need the code to work in the
% non-verbatim mode, as well, and we might stumble upon a brace there. So
@@ -1692,13 +1723,13 @@
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
% Expand |\collargs at empty| at the start of |##1|.
- \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \expandafter\toksapp\expandafter0\expandafter{##1}%
\collargs at gobbleUntilE@i
}%
% Initialize.
\collargs at begins=0\relax
\collargsArg{}%
- \toks@{}%
+ \toks0{}%
% We will call |\collargs at gobbleUntilE| via the caller control sequence.
\collargs at letusecollector\collargs at gobbleUntilE
% We insert |\collargs at empty| to avoid the potential debracing problem.
@@ -1726,7 +1757,7 @@
\expandafter\collargs at gobbleOneB@v
\else
% Append the real begin-tag to the temporary tokens.
- \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \etoksapp0{\expandonce\collargs at begintag}%
\expandafter\collargs at gobbleOneB@ii
\fi
}%
@@ -1754,7 +1785,7 @@
\fi
% Whatever the result was, we have to append the gobbled group to the
% temporary toks.
- \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \etoksapp0{\collargs at grabbed@spaces\unexpanded{{#1}}}%
\collargs at init@grabspaces
\collargs at gobbleOneB@vi
}
@@ -1761,7 +1792,7 @@
\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
\def\collargs at gobbleOneB@vi{%
% Store.
- \etoksapp\collargsArg{\the\toks@}%
+ \etoksapp\collargsArg{\the\toks0}%
% Advance the begin-tag counter.
\advance\collargs at begins\collargs at begins@increment\relax
% Find more begin-tags, unless this was the final one.
@@ -1785,7 +1816,7 @@
}%
}
\def\collargs at gobbleUntilE@iii#1{%
- \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \etoksapp0{\collargs at grabbed@spaces}%
\collargs at init@grabspaces
\def\collargs at tempa{#1}%
\ifx\collargs at tempa\collargs at tagarg
@@ -1794,7 +1825,7 @@
\else
% Nope, this |\end| belongs to someone else. Insert the end tag plus the
% tag argument, and collect until the next |\end|.
- \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\toksapp\expandafter0\expandafter{\collargs at endtag{#1}}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\fi
}
@@ -1802,7 +1833,7 @@
% Invoke |\collargs at gobbleOneB| with the collected material, plus a fake
% begin-tag and a quark guard.
\ifcollargsIgnoreNesting
- \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargsArg\expandafter{\the\toks0}%
\expandafter\collargs at commandatend
\else
\expandafter\collargs at gobbleUntilE@v
@@ -1812,7 +1843,7 @@
\expanded{%
\noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
\noexpand\collargs at empty
- \the\toks@
+ \the\toks0
% Add a fake begin-tag and a quark guard.
\expandonce\collargs at begintag
\noexpand\collargs at qend
@@ -1825,7 +1856,7 @@
\expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
\expandonce\collargs at tagarg}\fi
}%
- \toks@={}%
+ \toks0={}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\expandafter\collargs at empty
\fi
Modified: trunk/Master/texmf-dist/source/generic/collargs/collargs.ins
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/collargs.ins 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/source/generic/collargs/collargs.ins 2024-01-03 21:18:30 UTC (rev 69284)
@@ -9,11 +9,11 @@
%% (Sa\v{s}o \v{Z}ivanovi\'{c})
%%
%% This work may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this license or (at your
-%% option) any later version. The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
-%% all distributions of LaTeX version 2005/12/01 or later.
-%%
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
+%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
%%
Modified: trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/tex/context/third/collargs/t-collargs.tex 2024-01-03 21:18:30 UTC (rev 69284)
@@ -16,10 +16,10 @@
%% (Sa\v{s}o \v{Z}ivanovi\'{c})
%%
%% This work may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this license or (at your
-%% option) any later version. The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
-%% all distributions of LaTeX version 2005/12/01 or later.
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
@@ -28,11 +28,11 @@
%% (<texmf>/doc/generic/collargs/)FILES.
%D \module[
%D file=t-collargs.tex,
-%D version=1.0.0,
+%D version=1.1.0,
%D title=CollArgs,
%D subtitle=Collect arguments of any command,
%D author=Saso Zivanovic,
-%D date=2023-10-07,
+%D date=2024-01-02,
%D copyright=Saso Zivanovic,
%D license=LPPL,
%D ]
@@ -41,19 +41,25 @@
\startmodule[collargs]
\input t-pgfkey
\input etoolbox-generic
-\ifdefined\toksapp\else
- \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\ifdefined\luatexversion
+\else
+ \def\toksapp{\toks at cs@or at num\@toksapp}
+ \def\gtoksapp{\toks at cs@or at num\@gtoksapp}
+ \def\etoksapp{\toks at cs@or at num\@etoksapp}
+ \def\xtoksapp{\toks at cs@or at num\@xtoksapp}
+ \def\toks at cs@or at num#1#2#{%
+ \ifnum-2>-1#2
+ \expandafter\toks at cs@or at num@num
+ \fi
+ \toks at cs@or at num@cs{#1}{#2}%
+ }
+ \def\toks at cs@or at num@cs#1#2{#1{#2}}
+ \def\toks at cs@or at num@num\toks at cs@or at num@cs#1#2{#1{\toks#2 }}
+ \long\def\@toksapp#1#2{#1\expandafter{\the#1#2}}%
+ \long\def\@etoksapp#1#2{#1\expandafter{\normalexpanded{\the#1#2}}}%
+ \long\def\@gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+ \long\def\@xtoksapp#1#2{\global#1\expandafter{\normalexpanded{\the#1#2}}}%
\fi
-\ifdefined\etoksapp\else
- \long\def\etoksapp#1#2{#1\expandafter{\normalexpanded{\the#1#2}}}%
-\fi
-\ifdefined\gtoksapp\else
- \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
-\fi
-\ifdefined\xtoksapp\else
- \long\def\xtoksapp#1#2{\global#1\expandafter{\normalexpanded{\the#1#2}}}%
-\fi
-\ifdefined\toks@\else\toksdef\toks@=0 \fi
\protected\def\CollectArguments{%
\pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
}
@@ -253,6 +259,12 @@
no delimiters/.is if=collargsNoDelimiters,
}
\newif\ifcollargsNoDelimiters
+
+\collargsSet{%
+ brace collected/.is if=collargsBraceCollected,
+}
+\newif\ifcollargsBraceCollected
+\collargsBraceCollectedtrue
\def\collargs@{%
\begingroup
\collargs@@@
@@ -322,7 +334,12 @@
\normalexpanded{%
\endgroup
\noexpand\collargs at fix{%
- \expandonce\collargs at next{\the\collargs at toks}%
+ \expandonce\collargs at next
+ \ifcollargsBraceCollected
+ {\the\collargs at toks}%
+ \else
+ \the\collargs at toks
+ \fi
\collargs at spaces
}%
}%
@@ -895,17 +912,17 @@
\def\collargs at readContent{%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
- \expandafter\toks@\expandafter{##1}%
+ \toks0\expandafter{##1}%
\futurelet\collargs at temp\collargs at gobbleOneB@i
}%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
- \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \expandafter\toksapp\expandafter0\expandafter{##1}%
\collargs at gobbleUntilE@i
}%
\collargs at begins=0\relax
\collargsArg{}%
- \toks@{}%
+ \toks0{}%
\collargs at letusecollector\collargs at gobbleUntilE
\collargs at empty
}
@@ -921,7 +938,7 @@
\def\collargs at begins@increment{-1}%
\expandafter\collargs at gobbleOneB@v
\else
- \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \etoksapp0{\expandonce\collargs at begintag}%
\expandafter\collargs at gobbleOneB@ii
\fi
}%
@@ -943,13 +960,13 @@
\else
\def\collargs at begins@increment{0}%
\fi
- \etoksapp\toks@{\collargs at grabbed@spaces\normalunexpanded{{#1}}}%
+ \etoksapp0{\collargs at grabbed@spaces\normalunexpanded{{#1}}}%
\collargs at init@grabspaces
\collargs at gobbleOneB@vi
}
\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
\def\collargs at gobbleOneB@vi{%
- \etoksapp\collargsArg{\the\toks@}%
+ \etoksapp\collargsArg{\the\toks0}%
\advance\collargs at begins\collargs at begins@increment\relax
\ifnum\collargs at begins@increment=-1
\else
@@ -969,19 +986,19 @@
}%
}
\def\collargs at gobbleUntilE@iii#1{%
- \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \etoksapp0{\collargs at grabbed@spaces}%
\collargs at init@grabspaces
\def\collargs at tempa{#1}%
\ifx\collargs at tempa\collargs at tagarg
\expandafter\collargs at gobbleUntilE@iv
\else
- \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\toksapp\expandafter0\expandafter{\collargs at endtag{#1}}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\fi
}
\def\collargs at gobbleUntilE@iv{%
\ifcollargsIgnoreNesting
- \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargsArg\expandafter{\the\toks0}%
\expandafter\collargs at commandatend
\else
\expandafter\collargs at gobbleUntilE@v
@@ -991,7 +1008,7 @@
\normalexpanded{%
\noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
\noexpand\collargs at empty
- \the\toks@
+ \the\toks0
\expandonce\collargs at begintag
\noexpand\collargs at qend
}%
@@ -1003,7 +1020,7 @@
\expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
\expandonce\collargs at tagarg}\fi
}%
- \toks@={}%
+ \toks0={}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\expandafter\collargs at empty
\fi
Modified: trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty 2024-01-03 21:18:30 UTC (rev 69284)
@@ -16,10 +16,10 @@
%% (Sa\v{s}o \v{Z}ivanovi\'{c})
%%
%% This work may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this license or (at your
-%% option) any later version. The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
-%% all distributions of LaTeX version 2005/12/01 or later.
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
@@ -26,22 +26,28 @@
%%
%% The files belonging to this work and covered by LPPL are listed in
%% (<texmf>/doc/generic/collargs/)FILES.
-\ProvidesPackage{collargs}[2023/10/07 v1.0.0 Collect arguments of any command]
+\ProvidesPackage{collargs}[2024/01/02 v1.1.0 Collect arguments of any command]
\RequirePackage{pgfkeys}
\RequirePackage{etoolbox}
-\ifdefined\toksapp\else
- \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\ifdefined\luatexversion
+\else
+ \def\toksapp{\toks at cs@or at num\@toksapp}
+ \def\gtoksapp{\toks at cs@or at num\@gtoksapp}
+ \def\etoksapp{\toks at cs@or at num\@etoksapp}
+ \def\xtoksapp{\toks at cs@or at num\@xtoksapp}
+ \def\toks at cs@or at num#1#2#{%
+ \ifnum-2>-1#2
+ \expandafter\toks at cs@or at num@num
+ \fi
+ \toks at cs@or at num@cs{#1}{#2}%
+ }
+ \def\toks at cs@or at num@cs#1#2{#1{#2}}
+ \def\toks at cs@or at num@num\toks at cs@or at num@cs#1#2{#1{\toks#2 }}
+ \long\def\@toksapp#1#2{#1\expandafter{\the#1#2}}%
+ \long\def\@etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+ \long\def\@gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+ \long\def\@xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
\fi
-\ifdefined\etoksapp\else
- \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\gtoksapp\else
- \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
-\fi
-\ifdefined\xtoksapp\else
- \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\toks@\else\toksdef\toks@=0 \fi
\protected\def\CollectArguments{%
\pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
}
@@ -242,6 +248,12 @@
no delimiters/.is if=collargsNoDelimiters,
}
\newif\ifcollargsNoDelimiters
+
+\collargsSet{%
+ brace collected/.is if=collargsBraceCollected,
+}
+\newif\ifcollargsBraceCollected
+\collargsBraceCollectedtrue
\def\collargs@{%
\begingroup
\collargs@@@
@@ -311,7 +323,12 @@
\expanded{%
\endgroup
\noexpand\collargs at fix{%
- \expandonce\collargs at next{\the\collargs at toks}%
+ \expandonce\collargs at next
+ \ifcollargsBraceCollected
+ {\the\collargs at toks}%
+ \else
+ \the\collargs at toks
+ \fi
\collargs at spaces
}%
}%
@@ -913,17 +930,17 @@
\def\collargs at readContent{%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
- \expandafter\toks@\expandafter{##1}%
+ \toks0\expandafter{##1}%
\futurelet\collargs at temp\collargs at gobbleOneB@i
}%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
- \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \expandafter\toksapp\expandafter0\expandafter{##1}%
\collargs at gobbleUntilE@i
}%
\collargs at begins=0\relax
\collargsArg{}%
- \toks@{}%
+ \toks0{}%
\collargs at letusecollector\collargs at gobbleUntilE
\collargs at empty
}
@@ -939,7 +956,7 @@
\def\collargs at begins@increment{-1}%
\expandafter\collargs at gobbleOneB@v
\else
- \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \etoksapp0{\expandonce\collargs at begintag}%
\expandafter\collargs at gobbleOneB@ii
\fi
}%
@@ -961,13 +978,13 @@
\else
\def\collargs at begins@increment{0}%
\fi
- \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \etoksapp0{\collargs at grabbed@spaces\unexpanded{{#1}}}%
\collargs at init@grabspaces
\collargs at gobbleOneB@vi
}
\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
\def\collargs at gobbleOneB@vi{%
- \etoksapp\collargsArg{\the\toks@}%
+ \etoksapp\collargsArg{\the\toks0}%
\advance\collargs at begins\collargs at begins@increment\relax
\ifnum\collargs at begins@increment=-1
\else
@@ -987,19 +1004,19 @@
}%
}
\def\collargs at gobbleUntilE@iii#1{%
- \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \etoksapp0{\collargs at grabbed@spaces}%
\collargs at init@grabspaces
\def\collargs at tempa{#1}%
\ifx\collargs at tempa\collargs at tagarg
\expandafter\collargs at gobbleUntilE@iv
\else
- \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\toksapp\expandafter0\expandafter{\collargs at endtag{#1}}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\fi
}
\def\collargs at gobbleUntilE@iv{%
\ifcollargsIgnoreNesting
- \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargsArg\expandafter{\the\toks0}%
\expandafter\collargs at commandatend
\else
\expandafter\collargs at gobbleUntilE@v
@@ -1009,7 +1026,7 @@
\expanded{%
\noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
\noexpand\collargs at empty
- \the\toks@
+ \the\toks0
\expandonce\collargs at begintag
\noexpand\collargs at qend
}%
@@ -1021,7 +1038,7 @@
\expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
\expandonce\collargs at tagarg}\fi
}%
- \toks@={}%
+ \toks0={}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\expandafter\collargs at empty
\fi
Modified: trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex 2024-01-03 21:18:16 UTC (rev 69283)
+++ trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex 2024-01-03 21:18:30 UTC (rev 69284)
@@ -16,10 +16,10 @@
%% (Sa\v{s}o \v{Z}ivanovi\'{c})
%%
%% This work may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this license or (at your
-%% option) any later version. The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of
-%% all distributions of LaTeX version 2005/12/01 or later.
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
@@ -30,19 +30,25 @@
\input etoolbox-generic
\edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}
\catcode`\@11\relax
-\ifdefined\toksapp\else
- \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\ifdefined\luatexversion
+\else
+ \def\toksapp{\toks at cs@or at num\@toksapp}
+ \def\gtoksapp{\toks at cs@or at num\@gtoksapp}
+ \def\etoksapp{\toks at cs@or at num\@etoksapp}
+ \def\xtoksapp{\toks at cs@or at num\@xtoksapp}
+ \def\toks at cs@or at num#1#2#{%
+ \ifnum-2>-1#2
+ \expandafter\toks at cs@or at num@num
+ \fi
+ \toks at cs@or at num@cs{#1}{#2}%
+ }
+ \def\toks at cs@or at num@cs#1#2{#1{#2}}
+ \def\toks at cs@or at num@num\toks at cs@or at num@cs#1#2{#1{\toks#2 }}
+ \long\def\@toksapp#1#2{#1\expandafter{\the#1#2}}%
+ \long\def\@etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+ \long\def\@gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+ \long\def\@xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
\fi
-\ifdefined\etoksapp\else
- \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\gtoksapp\else
- \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
-\fi
-\ifdefined\xtoksapp\else
- \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
-\fi
-\ifdefined\toks@\else\toksdef\toks@=0 \fi
\protected\def\CollectArguments{%
\pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
}
@@ -241,6 +247,12 @@
no delimiters/.is if=collargsNoDelimiters,
}
\newif\ifcollargsNoDelimiters
+
+\collargsSet{%
+ brace collected/.is if=collargsBraceCollected,
+}
+\newif\ifcollargsBraceCollected
+\collargsBraceCollectedtrue
\def\collargs@{%
\begingroup
\collargs@@@
@@ -310,7 +322,12 @@
\expanded{%
\endgroup
\noexpand\collargs at fix{%
- \expandonce\collargs at next{\the\collargs at toks}%
+ \expandonce\collargs at next
+ \ifcollargsBraceCollected
+ {\the\collargs at toks}%
+ \else
+ \the\collargs at toks
+ \fi
\collargs at spaces
}%
}%
@@ -882,17 +899,17 @@
\def\collargs at readContent{%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
- \expandafter\toks@\expandafter{##1}%
+ \toks0\expandafter{##1}%
\futurelet\collargs at temp\collargs at gobbleOneB@i
}%
\ifcollargs at long\long\fi
\collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
- \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \expandafter\toksapp\expandafter0\expandafter{##1}%
\collargs at gobbleUntilE@i
}%
\collargs at begins=0\relax
\collargsArg{}%
- \toks@{}%
+ \toks0{}%
\collargs at letusecollector\collargs at gobbleUntilE
\collargs at empty
}
@@ -908,7 +925,7 @@
\def\collargs at begins@increment{-1}%
\expandafter\collargs at gobbleOneB@v
\else
- \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \etoksapp0{\expandonce\collargs at begintag}%
\expandafter\collargs at gobbleOneB@ii
\fi
}%
@@ -930,13 +947,13 @@
\else
\def\collargs at begins@increment{0}%
\fi
- \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \etoksapp0{\collargs at grabbed@spaces\unexpanded{{#1}}}%
\collargs at init@grabspaces
\collargs at gobbleOneB@vi
}
\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
\def\collargs at gobbleOneB@vi{%
- \etoksapp\collargsArg{\the\toks@}%
+ \etoksapp\collargsArg{\the\toks0}%
\advance\collargs at begins\collargs at begins@increment\relax
\ifnum\collargs at begins@increment=-1
\else
@@ -956,19 +973,19 @@
}%
}
\def\collargs at gobbleUntilE@iii#1{%
- \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \etoksapp0{\collargs at grabbed@spaces}%
\collargs at init@grabspaces
\def\collargs at tempa{#1}%
\ifx\collargs at tempa\collargs at tagarg
\expandafter\collargs at gobbleUntilE@iv
\else
- \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\toksapp\expandafter0\expandafter{\collargs at endtag{#1}}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\fi
}
\def\collargs at gobbleUntilE@iv{%
\ifcollargsIgnoreNesting
- \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargsArg\expandafter{\the\toks0}%
\expandafter\collargs at commandatend
\else
\expandafter\collargs at gobbleUntilE@v
@@ -978,7 +995,7 @@
\expanded{%
\noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
\noexpand\collargs at empty
- \the\toks@
+ \the\toks0
\expandonce\collargs at begintag
\noexpand\collargs at qend
}%
@@ -990,7 +1007,7 @@
\expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
\expandonce\collargs at tagarg}\fi
}%
- \toks@={}%
+ \toks0={}%
\expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
\expandafter\collargs at empty
\fi
More information about the tex-live-commits
mailing list.