summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-ext.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/syst-ext.tex')
-rw-r--r--tex/context/base/syst-ext.tex40
1 files changed, 31 insertions, 9 deletions
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index 9b64e25ae..afda909c2 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -1862,7 +1862,8 @@
\next}
%D \macros
-%D {appendtocommalist,addtocommalist,removefromcommalist}
+%D {appendtocommalist,prependtocommalist,
+%D addtocommalist,removefromcommalist}
%D
%D When working with comma separated lists, one sooner or
%D later want the tools to append or remove items from such a
@@ -1894,7 +1895,8 @@
%D also provided:
%D
%D \starttypen
-%D \appendtocommalist {something} \name
+%D \appendtocommalist {something} \name
+%D \prependtocommalist {something} \name
%D \stoptypen
\def\appendtocommalist#1#2%
@@ -1904,14 +1906,34 @@
\dodoglobal\edef#2{#2,#1}%
\fi}
+\def\prependtocommalist#1#2%
+ {\ifx#2\empty
+ \dodoglobal\edef#2{#1}%
+ \else % no test on empty
+ \dodoglobal\edef#2{#1,#2}%
+ \fi}
+
\def\addtocommalist#1#2%
- {\doifelse{#2}{}
- {\dodoglobal\edef#2{#1}}
- {\edef\!!stringa{#2,,}%
- \beforesplitstring#2\at,,\to#2\relax
- \ExpandBothAfter\doifinsetelse{#1}{#2}
- {\resetglobal}
- {\dodoglobal\edef#2{#2,#1}}}}
+ {\ifx#2\empty
+ \dodoglobal\edef#2{#1}%
+ \else
+ \edef\!!stringa{#2,,}%
+ \beforesplitstring#2\at,,\to#2\relax
+ \ExpandBothAfter\doifinsetelse{#1}{#2}
+ {\resetglobal}
+ {\dodoglobal\edef#2{#2,#1}}%
+ \fi}
+
+\def\pretocommalist#1#2%
+ {\ifx#2\empty
+ \dodoglobal\edef#2{#1}%
+ \else
+ \edef\!!stringa{#2,,}%
+ \beforesplitstring#2\at,,\to#2\relax
+ \ExpandBothAfter\doifinsetelse{#1}{#2}
+ {\resetglobal}
+ {\dodoglobal\edef#2{#1,#2}}%
+ \fi}
\def\doremovefromcommalist#1#2#3% nog \doglobal
{\edef\!!stringa{,,#3,,}%