texlive[59452] Master/texmf-dist: expkv (3jun21)
commits+karl at tug.org
commits+karl at tug.org
Thu Jun 3 22:49:04 CEST 2021
Revision: 59452
http://tug.org/svn/texlive?view=revision&revision=59452
Author: karl
Date: 2021-06-03 22:49:04 +0200 (Thu, 03 Jun 2021)
Log Message:
-----------
expkv (3jun21)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/expkv/README.md
trunk/Master/texmf-dist/doc/latex/expkv/expkv.pdf
trunk/Master/texmf-dist/source/latex/expkv/expkv.dtx
trunk/Master/texmf-dist/tex/generic/expkv/expkv.tex
Modified: trunk/Master/texmf-dist/doc/latex/expkv/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/expkv/README.md 2021-06-03 20:48:51 UTC (rev 59451)
+++ trunk/Master/texmf-dist/doc/latex/expkv/README.md 2021-06-03 20:49:04 UTC (rev 59452)
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv -- an expandable key=val implementation
-Version 2021-05-24 v1.8
+Version 2021-06-03 v1.8a
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
Modified: trunk/Master/texmf-dist/doc/latex/expkv/expkv.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/expkv/expkv.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/expkv/expkv.dtx 2021-06-03 20:48:51 UTC (rev 59451)
+++ trunk/Master/texmf-dist/source/latex/expkv/expkv.dtx 2021-06-03 20:49:04 UTC (rev 59452)
@@ -529,7 +529,7 @@
% sets are discarded, if the \key\ isn't found in any set an error will be
% thrown eventually. Note that the error messages are affected by the use of
% this macro, in particular, it isn't checked whether a |NoVal| key of the
-% same name is defined in order to throw a |value forbidden| error.
+% same name is defined in order to throw an |unwanted value| error.
% |\ekvdefunknown| and |\ekvredirectunknown| are mutually exclusive,
% you can't use both.
% \end{function}
@@ -547,7 +547,7 @@
% |NoVal| keys. Again no prefixes are supported. Note that the error messages
% are affected by the use of this macro, in particular, it isn't checked
% whether a normal key of the same name is defined in order to throw a
-% |value forbidden| error.
+% |missing value| error.
% |\ekvdefunknownNoVal| and |\ekvredirectunknownNoVal| are mutually exclusive,
% you can't use both.
% \end{function}
@@ -694,13 +694,18 @@
% the \key. There are no macros like these two contained in \expkv, you have
% to set them up yourself if you want to use |\ekvparse| (of course the names
% might differ). If you need the results of |\ekvparse| as the argument for
-% another macro, you should use |\expanded| as only then the input stream will
-% contain the output above:
+% another macro, you should use |\expanded|, or expand |\ekvparse| twice, as
+% only then the input stream will contain the output above:
% \begin{lstlisting}
% \expandafter\parse\expanded{\ekvparse\k\kv{foo = bar, key, baz={zzz}}}
% \end{lstlisting}
-% would expand to
+% or
% \begin{lstlisting}
+% \expandafter\expandafter\expandafter
+% \parse\ekvparse\k\kv{foo = bar, key, baz={zzz}}
+% \end{lstlisting}
+% would both expand to
+% \begin{lstlisting}
% \parse\kv{foo}{bar}\k{key}\kv{baz}{zzz}
% \end{lstlisting}
%
@@ -808,11 +813,12 @@
% \meta{next}\marg{default}\marg{mandatory} (so the default will be used and
% the mandatory argument will be wrapped in braces).
% \end{function}
-% |\ekvoptarg| expands in exactly two steps and is alignment safe. It has its
-% limitations however. It can't tell the difference between |[| and |{[}|, so it
-% doesn't work if the mandatory argument is a single bracket. Also if the
-% optional argument should contain a nested closing bracket, the optional
-% argument has to use nested braces like so: |[{arg]ument}]|.
+% |\ekvoptarg| expands in exactly two steps, grabs all the arguments only at the
+% second expansion step, and is alignment safe. It has its limitations however.
+% It can't tell the difference between |[| and |{[}|, so it doesn't work if the
+% mandatory argument is a single bracket. Also if the optional argument should
+% contain a nested closing bracket, the optional argument has to use nested
+% braces like so: |[{arg]ument}]|.
% \example Say we have a macro that should take an optional argument defaulting
% to 1:
% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
@@ -828,8 +834,9 @@
% \meta{true}\marg{optional}\meta{mandatory} or \meta{false}\marg{mandatory}
% instead of placing a default value.
% \end{function}
-% |\ekvoptargTF| expands in exactly two steps and is alignment safe. It has the
-% same limitations as |\ekvoptarg|.
+% |\ekvoptargTF| expands in exactly two steps, grabs all the arguments only at
+% the second expansion step, and is alignment safe. It has the same limitations
+% as |\ekvoptarg|.
% \example Say we have a macro that should behave differently depending on
% whether there was an optional argument or not. This could be done with:
% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
@@ -1207,7 +1214,7 @@
% \file{expkv.tex} checks whether \eTeX\ and the |\expanded| primitive are
% available. If it isn't, an error will be thrown using |\errmessage|:
% \begin{lstlisting}
-% ! expkv Error: e-TeX required.
+% ! expkv Error: e-TeX and \expanded required.
% \end{lstlisting}
%
% \subsubsection{Defining Keys}
@@ -1547,8 +1554,8 @@
% \begin{macro}{\ekvVersion,\ekvDate}
% We're on our first input, so lets store the version and date in a macro.
% \begin{macrocode}
-\def\ekvVersion{1.8}
-\def\ekvDate{2021-05-24}
+\def\ekvVersion{1.8a}
+\def\ekvDate{2021-06-03}
% \end{macrocode}
% \end{macro}
%
@@ -2689,30 +2696,28 @@
\def\ekvoptarg#1#2{%
\endgroup
% \end{macrocode}
-% The real definition starts an expansion context after grabbing the arguments.
-% |#1| will be the next step, |#2| the default value, and |#3| might be an
-% opening bracket, or the mandatory argument. We check for the opening bracket,
-% if it is found grab the optional argument, else leave |#1{#2}| in the input
-% stream after ending the expansion context.
+% The real definition starts an expansion context and afterwards grabs the
+% arguments. |#1| will be the next step, |#2| the default value, and |#3| might
+% be an opening bracket, or the mandatory argument. We check for the opening
+% bracket, if it is found grab the optional argument, else leave |#1{#2}| in the
+% input stream after ending the expansion context.
% \begin{macrocode}
-\long\def\ekvoptarg##1##2##3%
+\def\ekvoptarg{\romannumeral#1\ekv at optarg@a}
+\long\def\ekv at optarg@a##1##2##3%
{%
- \romannumeral
- #1%
- \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optarg\ekv at mark[\ekv at mark
+ \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optarg@b\ekv at mark[\ekv at mark
#2%
\@firstofone{\ekv at zero##1}{##2}{##3}%
- }
+ }%
% \end{macrocode}
% The other variant of this will do roughly the same. Here, |#1| will be the
% next step if an optional argument is found, |#2| the next step else, and |#3|
% might be the opening bracket or mandatory argument.
% \begin{macrocode}
-\long\def\ekvoptargTF##1##2##3%
+\def\ekvoptargTF{\romannumeral#1\ekv at optargTF@a}
+\long\def\ekv at optargTF@a##1##2##3%
{%
- \romannumeral
- #1%
- \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optargTF{##1}\ekv at mark[\ekv at mark
+ \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optargTF@b{##1}\ekv at mark[\ekv at mark
#2%
\@firstofone{\ekv at zero##2}{##3}%
}
@@ -2720,9 +2725,10 @@
% The two macros to grab the optional argument have to remove the remainder of
% the test and the wrong next step as well as grabbing the argument.
% \begin{macrocode}
-\long\def\ekv at optarg\ekv at mark[\ekv at mark\ifnum`##1\fi\@firstofone##2##3##4##5]%
+\long\def\ekv at optarg@b\ekv at mark[\ekv at mark\ifnum`##1\fi\@firstofone##2##3##4##5]%
{#2##2{##5}}
-\long\def\ekv at optargTF##1\ekv at mark[\ekv at mark\ifnum`##2\fi\@firstofone##3##4##5]%
+\long\def\ekv at optargTF@b
+ ##1\ekv at mark[\ekv at mark\ifnum`##2\fi\@firstofone##3##4##5]%
{#2\ekv at zero##1{##5}}
}
% \end{macrocode}
Modified: trunk/Master/texmf-dist/tex/generic/expkv/expkv.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/expkv/expkv.tex 2021-06-03 20:48:51 UTC (rev 59451)
+++ trunk/Master/texmf-dist/tex/generic/expkv/expkv.tex 2021-06-03 20:49:04 UTC (rev 59452)
@@ -44,8 +44,8 @@
\errmessage{expkv Error: e-TeX and \noexpand\expanded required}
\expandafter\endinput
\fi
-\def\ekvVersion{1.8}
-\def\ekvDate{2021-05-24}
+\def\ekvVersion{1.8a}
+\def\ekvDate{2021-06-03}
\csname ekv at tmp\endcsname
\expandafter\chardef\csname ekv at tmp\endcsname=\catcode`\@
\catcode`\@=11
@@ -658,25 +658,24 @@
\begingroup
\def\ekvoptarg#1#2{%
\endgroup
-\long\def\ekvoptarg##1##2##3%
+\def\ekvoptarg{\romannumeral#1\ekv at optarg@a}
+\long\def\ekv at optarg@a##1##2##3%
{%
- \romannumeral
- #1%
- \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optarg\ekv at mark[\ekv at mark
+ \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optarg@b\ekv at mark[\ekv at mark
#2%
\@firstofone{\ekv at zero##1}{##2}{##3}%
- }
-\long\def\ekvoptargTF##1##2##3%
+ }%
+\def\ekvoptargTF{\romannumeral#1\ekv at optargTF@a}
+\long\def\ekv at optargTF@a##1##2##3%
{%
- \romannumeral
- #1%
- \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optargTF{##1}\ekv at mark[\ekv at mark
+ \ekv at optarg@if\ekv at mark##3\ekv at mark\ekv at optargTF@b{##1}\ekv at mark[\ekv at mark
#2%
\@firstofone{\ekv at zero##2}{##3}%
}
-\long\def\ekv at optarg\ekv at mark[\ekv at mark\ifnum`##1\fi\@firstofone##2##3##4##5]%
+\long\def\ekv at optarg@b\ekv at mark[\ekv at mark\ifnum`##1\fi\@firstofone##2##3##4##5]%
{#2##2{##5}}
-\long\def\ekv at optargTF##1\ekv at mark[\ekv at mark\ifnum`##2\fi\@firstofone##3##4##5]%
+\long\def\ekv at optargTF@b
+ ##1\ekv at mark[\ekv at mark\ifnum`##2\fi\@firstofone##3##4##5]%
{#2\ekv at zero##1{##5}}
}
\ekv at exparg{\expandafter\ekvoptarg\expandafter{\ekv at alignsafe}}\ekv at endalignsafe
More information about the tex-live-commits
mailing list.