From 6cf29a8f570cdc92864dd567023f539dd2667527 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 16 Jul 2021 19:56:17 +0000
Subject: expkv (16jul21)

git-svn-id: svn://tug.org/texlive/trunk@59949 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/expkv/expkv.tex | 80 +++++++++++++++++++--------
 1 file changed, 57 insertions(+), 23 deletions(-)

(limited to 'Master/texmf-dist/tex/generic/expkv/expkv.tex')

diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex
index f1c4719476b..16dd65d3e2f 100644
--- a/Master/texmf-dist/tex/generic/expkv/expkv.tex
+++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex
@@ -44,8 +44,8 @@
   \errmessage{expkv Error: e-TeX and \noexpand\expanded required}
   \expandafter\endinput
 \fi
-\def\ekvVersion{1.8a}
-\def\ekvDate{2021-06-03}
+\def\ekvVersion{1.9}
+\def\ekvDate{2021-07-15}
 \csname ekv@tmp\endcsname
 \expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@
 \catcode`\@=11
@@ -136,21 +136,49 @@
 \long\def\ekv@exparg@#1#2{#2{#1}}%
 \long\def\ekv@expargtwice#1#2{\expandafter\ekv@expargtwice@\expandafter{#2}{#1}}
 \def\ekv@expargtwice@{\expandafter\ekv@exparg@\expandafter}
-\ekv@exparg{\long\def\ekv@csv@loop#1#2,}%
+\begingroup
+\def\ekvcsvloop#1{%
+\endgroup
+\long\def\ekvcsvloop##1##2%
+  {\ekv@csv@loop@active{##1}\ekv@mark##2#1\ekv@stop#1}
+\long\def\ekv@csv@loop@active##1##2#1%
   {%
-    \expandafter
-    \ekv@gobble@from@mark@to@stop
-      \expandafter#\expandafter2\expandafter\ekv@csv@loop@end\expandafter
+    \ekv@gobble@from@mark@to@stop##2\ekv@csv@loop@active@end\ekv@stop
+    \ekv@csv@loop{##1}##2,\ekv@stop,%
+  }%
+\long\def\ekv@csv@loop@active@end
     \ekv@stop
-    \ekv@strip{#2}{\ekv@csv@loop@do{#1}}%
-    \ekv@csv@loop{#1}\ekv@mark
-  }
-\long\def\ekv@csv@loop@do#1#2{\unexpanded{#1{#2}}}
-\long\expandafter\def\expandafter\ekv@csv@loop@end
-    \expandafter\ekv@stop
-    \ekv@strip{#1}#2%
-    \ekv@csv@loop#3\ekv@mark
-  {}
+    \ekv@csv@loop##1\ekv@mark\ekv@stop,\ekv@stop,%
+  {}%
+}
+\catcode`\,=13
+\ekvcsvloop,
+\def\ekv@csv@loop#1%
+  {%
+    \long\def\ekv@csv@loop##1##2,%
+      {%
+        \ekv@gobble@from@mark@to@stop##2\ekv@csv@loop@end\ekv@stop
+        \ekv@ifblank@##2\ekv@nil\ekv@ifempty@B\ekv@csv@loop@blank
+          \ekv@ifempty@A\ekv@ifempty@B
+        #1\ekv@csv@loop@do{##1}%
+      }%
+  }
+\expandafter\ekv@csv@loop\expandafter{\ekv@strip{#2}}
+\long\def\ekv@csv@loop@do#1#2{\unexpanded{#2{#1}}\ekv@csv@loop{#2}\ekv@mark}
+\def\ekv@csv@loop@end#1%
+  {%
+    \long\def\ekv@csv@loop@end
+        \ekv@stop
+        \ekv@ifblank@\ekv@mark\ekv@stop\ekv@nil\ekv@ifempty@B\ekv@csv@loop@blank
+        \ekv@ifempty@A\ekv@ifempty@B
+        #1\ekv@csv@loop@do##1%
+      {\ekv@csv@loop@active{##1}\ekv@mark}%
+  }
+\expandafter\ekv@csv@loop@end\expandafter{\ekv@strip{\ekv@mark\ekv@stop}}
+\long\expandafter\def\expandafter\ekv@csv@loop@blank
+    \expandafter\ekv@ifempty@A\expandafter\ekv@ifempty@B
+    \ekv@strip{\ekv@mark#1}\ekv@csv@loop@do#2%
+  {\ekv@csv@loop{#2}\ekv@mark}
 \def\ekv@name@set#1{ekv#1(}
 \def\ekv@name@key#1{#1)}
 \edef\ekv@name
@@ -269,9 +297,9 @@
     \begingroup
     \edef\ekv@tmp
       {%
-        \ekv@csv@loop#1\ekv@mark#6,\ekv@stop,%
+        \ekvcsvloop#1{#6}%
         \unexpanded{#2}%
-        {\ekv@csv@loop{}\ekv@mark#5,#6,\ekv@stop,}%
+        {\ekvcsvloop{}{#5,#6}}%
       }%
     \ekv@expargtwice
       {\endgroup#3{#5}}%
@@ -658,27 +686,33 @@
 \begingroup
 \def\ekvoptarg#1#2{%
 \endgroup
-\def\ekvoptarg{\romannumeral#1\ekv@optarg@a}
+\def\ekvoptarg{#1\ekv@optarg@a}
 \long\def\ekv@optarg@a##1##2##3%
   {%
     \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optarg@b\ekv@mark[\ekv@mark
     #2%
-    \@firstofone{\ekv@zero##1}{##2}{##3}%
+    \@firstofone{ ##1}{##2}{##3}%
   }%
-\def\ekvoptargTF{\romannumeral#1\ekv@optargTF@a}
+\def\ekvoptargTF{#1\ekv@optargTF@a}
 \long\def\ekv@optargTF@a##1##2##3%
   {%
     \ekv@optarg@if\ekv@mark##3\ekv@mark\ekv@optargTF@b{##1}\ekv@mark[\ekv@mark
     #2%
-    \@firstofone{\ekv@zero##2}{##3}%
+    \@firstofone{ ##2}{##3}%
   }
 \long\def\ekv@optarg@b\ekv@mark[\ekv@mark\ifnum`##1\fi\@firstofone##2##3##4##5]%
   {#2##2{##5}}
 \long\def\ekv@optargTF@b
     ##1\ekv@mark[\ekv@mark\ifnum`##2\fi\@firstofone##3##4##5]%
-  {#2\ekv@zero##1{##5}}
+  {#2 ##1{##5}}
 }
-\ekv@exparg{\expandafter\ekvoptarg\expandafter{\ekv@alignsafe}}\ekv@endalignsafe
+\ekv@exparg
+  {%
+    \expandafter\ekv@strip\expandafter
+      {\expandafter\ekv@mark\ekv@alignsafe}%
+      \ekvoptarg
+  }%
+  \ekv@endalignsafe
 \long\def\ekv@optarg@if#1\ekv@mark[\ekv@mark{}
 \def\ekv@err@cleanup\par{}
 \def\ekv@err@collect#1%
-- 
cgit v1.2.3

