summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/expkv/expkv.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/expkv/expkv.tex')
-rw-r--r--Master/texmf-dist/tex/generic/expkv/expkv.tex91
1 files changed, 72 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/generic/expkv/expkv.tex b/Master/texmf-dist/tex/generic/expkv/expkv.tex
index 3e356834d73..747a0ad35e4 100644
--- a/Master/texmf-dist/tex/generic/expkv/expkv.tex
+++ b/Master/texmf-dist/tex/generic/expkv/expkv.tex
@@ -39,8 +39,8 @@
\errmessage{expkv requires e-TeX}
\expandafter\endinput
\fi
-\def\ekvVersion{1.2}
-\def\ekvDate{2020-04-10}
+\def\ekvVersion{1.3}
+\def\ekvDate{2020-07-02}
\csname ekv@tmp\endcsname
\expandafter\chardef\csname ekv@tmp\endcsname=\catcode`\@
\catcode`\@=11
@@ -66,6 +66,11 @@
\long\def\ekv@ifempty@true@F@gobbletwo
\ekv@ifempty@A\ekv@ifempty@B\@firstofone#1#2#3%
{}
+\long\def\ekv@ifblank#1%
+ {%
+ \ekv@ifblank@#1\ekv@nil\ekv@ifempty@B\ekv@ifempty@true
+ \ekv@ifempty@A\ekv@ifempty@B\@secondoftwo
+ }
\long\def\ekv@ifblank@\ekv@mark#1{\ekv@ifempty@\ekv@ifempty@A}
\def\ekv@ifdefined#1%
{%
@@ -75,7 +80,7 @@
\fi
\@firstoftwo
}
-\def\ekv@name#1#2{\ekv@name@set{#1}\ekv@name@key{#2}}
+\def\ekv@name#1#2{\ekv@name@set{#1}\ekv@name@key{\detokenize{#2}}}
\def\ekv@name@set#1{ekv#1(}
\def\ekv@name@key#1{#1)}
\def\ekv@undefined@set#1{! expkv Error: Set `#1' undefined.}
@@ -103,7 +108,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\def\csname\ekv@name{#1}{#2}\endcsname##1{#3}%
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\long\def\ekvdefNoVal#1#2#3%
@@ -111,7 +116,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\def\csname\ekv@name{#1}{#2}N\endcsname{#3}%
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvlet#1#2#3%
@@ -119,7 +124,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\let\csname\ekv@name{#1}{#2}\endcsname#3%
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletNoVal#1#2#3%
@@ -127,7 +132,7 @@
\ekv@checkvalid{#1}{#2}%
{%
\expandafter\let\csname\ekv@name{#1}{#2}N\endcsname#3%
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletkv#1#2#3#4%
@@ -136,7 +141,7 @@
{%
\expandafter\let\csname\ekv@name{#1}{#2}\expandafter\endcsname
\csname\ekv@name{#3}{#4}\endcsname
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
\protected\def\ekvletkvNoVal#1#2#3#4%
@@ -145,13 +150,29 @@
{%
\expandafter\let\csname\ekv@name{#1}{#2}N\expandafter\endcsname
\csname\ekv@name{#3}{#4}N\endcsname
- \expandafter\ekv@defset\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ }%
+ }
+\protected\def\ekvdefunknown#1#2%
+ {%
+ \ekv@checkvalid{#1}{.}%
+ {%
+ \expandafter\def\csname\ekv@name{#1}{}u\endcsname##1##2{#2}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
+ }%
+ }
+\protected\def\ekvdefunknownNoVal#1#2%
+ {%
+ \ekv@checkvalid{#1}{.}%
+ {%
+ \expandafter\def\csname\ekv@name{#1}{}uN\endcsname##1{#2}%
+ \expandafter\ekv@defsetmacro\csname\ekv@undefined@set{#1}\endcsname{#1}%
}%
}
-\protected\def\ekv@defset#1#2%
+\protected\def\ekv@defsetmacro#1#2%
{%
\ifx#1\relax
- \edef#1##1{\ekv@name@set{#2}\ekv@name@key{##1}}%
+ \edef#1##1{\ekv@name@set{#2}\ekv@name@key{\noexpand\detokenize{##1}}}%
\fi
}
\def\ekvset#1#2{%
@@ -339,10 +360,22 @@
\endcsname
{#2}%
{%
- \ekv@ifdefined{#3{#1}N}%
- \ekv@err@noarg
- \ekv@err@unknown
- #3{#1}%
+ \expandafter\ekv@set@pair@
+ \csname
+ \ifcsname #3{}u\endcsname
+ #3{}u%
+ \else
+ relax%
+ \fi
+ \endcsname
+ {#2}%
+ {%
+ \ekv@ifdefined{#3{#1}N}%
+ \ekv@err@noarg
+ \ekv@err@unknown
+ #3%
+ }%
+ {#1}%
}%
}
\long\def\ekv@set@pair@#1#2%
@@ -364,10 +397,21 @@
\fi
\endcsname
{%
- \ekv@ifdefined{#2{#1}}%
- \ekv@err@reqval
- \ekv@err@unknown
- #2{#1}%
+ \expandafter\ekv@set@key@
+ \csname
+ \ifcsname #2{}uN\endcsname
+ #2{}uN%
+ \else
+ relax%
+ \fi
+ \endcsname
+ {%
+ \ekv@ifdefined{#2{#1}}%
+ \ekv@err@reqval
+ \ekv@err@unknown
+ #2%
+ }%
+ {#1}%
}%
}
\def\ekv@set@key@#1%
@@ -377,6 +421,15 @@
\fi
\@firstoftwo#1%
}
+\protected\def\ekvsetdef#1#2%
+ {%
+ \expandafter\expandafter\expandafter
+ \ekv@setdef\expandafter\expandafter\expandafter{\ekvset{#2}{##1}}#1%
+ }
+\protected\def\ekv@setdef#1#2%
+ {%
+ \long\def#2##1{#1}%
+ }
\begingroup
\edef\ekv@err
{%