summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-07-05 03:02:16 +0000
committerNorbert Preining <norbert@preining.info>2020-07-05 03:02:16 +0000
commitd7fedb6786f75a4709b3febbc539376f483001b3 (patch)
tree51661f5ede81a2998d5f07f0053d1fbc77fa5964 /macros
parentce9d7362aa8813c6cea1e0fe6974561f28a103a5 (diff)
CTAN sync 202007050302
Diffstat (limited to 'macros')
-rw-r--r--macros/generic/expkv-def/README.md2
-rw-r--r--macros/generic/expkv-def/expkv-def.dtx83
-rw-r--r--macros/generic/expkv-def/expkv-def.pdfbin303450 -> 305480 bytes
-rw-r--r--macros/generic/expkv-opt/README.md2
-rw-r--r--macros/generic/expkv-opt/expkv-opt.dtx18
-rw-r--r--macros/generic/expkv-opt/expkv-opt.pdfbin260968 -> 260700 bytes
-rw-r--r--macros/generic/expkv/README.md2
-rw-r--r--macros/generic/expkv/expkv.dtx32
-rw-r--r--macros/generic/expkv/expkv.pdfbin395772 -> 397919 bytes
9 files changed, 89 insertions, 50 deletions
diff --git a/macros/generic/expkv-def/README.md b/macros/generic/expkv-def/README.md
index 554b5a6dcf..444d887336 100644
--- a/macros/generic/expkv-def/README.md
+++ b/macros/generic/expkv-def/README.md
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv-def -- a key-defining frontend for expkv
-Version 2020-04-29 v0.3
+Version 2020-07-04 v0.4
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
diff --git a/macros/generic/expkv-def/expkv-def.dtx b/macros/generic/expkv-def/expkv-def.dtx
index 437c296d14..3dfff1f80f 100644
--- a/macros/generic/expkv-def/expkv-def.dtx
+++ b/macros/generic/expkv-def/expkv-def.dtx
@@ -354,7 +354,9 @@ and the derived files expkv-def.pdf
% commands which execute the |true| or |false| choice will be, so the usage
% should be safe in an expansion context (\emph{e.g.}, you can use
% \texttt{edefault \key\ = false} without an issue to change the default
-% behaviour to execute the |false| choice).
+% behaviour to execute the |false| choice). Internally a |bool| \key\ is the
+% same as a |choice| key which is set up to handle |true| and |false| as
+% choices.
% \end{function}
%
% \begin{function}{store,estore,gstore,xstore}
@@ -501,7 +503,20 @@ and the derived files expkv-def.pdf
% \meta{definition} will be left in the input stream. You can make
% individual values |protected| inside the \val=\meta{definition} list. By
% default a |choice| key is expandable, an undefined \val\ will throw an error
-% in an expandable way.
+% in an expandable way (but see the |unknown-choice| prefix). You can add
+% additional choices after the \key\ was created by using |choice| again for
+% the same \key, redefining choices is possible the same way, but there is no
+% interface to remove certain choices.
+% \end{function}
+%
+% \begin{function}{unknown-choice}
+% \begin{syntax}
+% unknown-choice \key\ = \marg{definition} \prefixes23
+% \end{syntax}
+% By default an unknown \val\ passed to a |choice| key will throw an error.
+% However, with this prefix you can define an alternative action which should
+% be executed if \key\ received an unknown choice. In \meta{definition} you
+% can refer to the choice which was passed in with |#1|.
% \end{function}
%
% \subsection{Bugs}
@@ -669,8 +684,8 @@ and the derived files expkv-def.pdf
% \begin{macro}{\ekvdVersion,\ekvdDate}
% We're on our first input, so lets store the version and date in a macro.
% \begin{macrocode}
-\def\ekvdVersion{0.3}
-\def\ekvdDate{2020-04-29}
+\def\ekvdVersion{0.4}
+\def\ekvdDate{2020-07-04}
% \end{macrocode}
% \end{macro}
%
@@ -1280,6 +1295,20 @@ and the derived files expkv-def.pdf
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\ekvd@t@unknown-choice}
+% \begin{macrocode}
+\protected\long\expandafter\def\csname ekvd@t@unknown-choice\endcsname#1#2%
+ {%
+ \ekvd@assert@arg{unknown-choice #1}{#2}%
+ {%
+ \ekvd@assert@not@long{unknown-choice #1}%
+ \ekvd@prot\expandafter
+ \def\csname\ekvd@unknown@choice@name\ekvd@set{#1}\endcsname##1{#2}%
+ }%
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Key Type Helpers}
% There are some keys that might need helpers during their execution (not during
% their definition, which are gathered as |@type@| macros). These helpers are
@@ -1309,23 +1338,6 @@ and the derived files expkv-def.pdf
%
% \subsubsection{Tests}
%
-% \begin{macro}[internal]{\ekvd@noarg@mark}
-% This macro serves as a flag for the case that no \val\ was specified for a
-% key. As such it is not a test, but exists only for some tests.
-% \begin{macrocode}
-\def\ekvd@noarg@mark{\ekvd@noarg@mark}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\ekvd@fi@firstoftwo}
-% While we can reuse many of the internals of \expkv\ the specific case for this
-% branch wasn't needed by \expkv\ and hence isn't defined. We'll need it, so we
-% define it.
-% \begin{macrocode}
-\long\def\ekvd@fi@firstoftwo\fi\@secondoftwo#1#2{\fi#1}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}[internal]{\ekvd@newlet,\ekvd@newreg}
% These macros test whether a control sequence is defined, if it isn't they
% define it, either via |\let| or via the correct \cs[no-index]{new\meta{reg}}.
@@ -1362,8 +1374,11 @@ and the derived files expkv-def.pdf
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\ekvd@assert@arg,\ekvd@ifnoarg}
-% The test for an argument is just an |\ifx| comparison with our |noarg@mark|.
+% \begin{macro}[internal]
+% {\ekvd@assert@arg,\ekvd@ifnoarg,\ekvd@ifnoarg@,\ekvd@ifnoarg@}
+% An |\ifx| comparison would fail if the first token of the user input is a
+% \TeX-if primitive or the user input contains unbalanced \TeX-if constructs, so
+% the test is done using \TeX's argument grabbing logic.
% \begin{macrocode}
\long\def\ekvd@assert@arg#1#2%
{%
@@ -1372,10 +1387,14 @@ and the derived files expkv-def.pdf
}
\long\def\ekvd@ifnoarg#1%
{%
- \ifx\ekvd@noarg@mark#1%
- \ekvd@fi@firstoftwo
- \fi
- \@secondoftwo
+ \ekvd@ifnoarg@\ekvd@ifnoarg@mark#1\ekvd@ifnoarg@mark\ekvd@ifnoarg@t
+ \ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark\@secondoftwo
+ }
+\long\def\ekvd@ifnoarg@#1\ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark{}
+\long\def\ekvd@ifnoarg@t
+ \ekvd@ifnoarg@mark\ekvd@noarg@mark\ekvd@ifnoarg@mark\@secondoftwo#1#2%
+ {%
+ #1%
}
% \end{macrocode}
% \end{macro}
@@ -1465,7 +1484,7 @@ and the derived files expkv-def.pdf
% \begin{macro}[internal]
% {
% \ekvd@err@choice@invalid,\ekvd@err@choice@invalid@,\ekvd@choice@name,
-% \ekvd@err
+% \ekvd@unknown@choice@name,\ekvd@err
% }
% The expandable error messages use |\ekvd@err|, which is just like |\ekv@err|
% from \expkv\ or the way \pkg{expl3} throws expandable error messages. It uses
@@ -1487,9 +1506,15 @@ and the derived files expkv-def.pdf
{%
ekvd#1(#2)#3%
}
+\def\ekvd@unknown@choice@name#1#2%
+ {%
+ ekvd:u:#1(#2)%
+ }
\def\ekvd@err@choice@invalid@ ekvd#1(#2)#3\ekv@stop%
{%
- \ekvd@err{invalid choice `#3' (`#2', set `#1')}%
+ \ekv@ifdefined{\ekvd@unknown@choice@name{#1}{#2}}%
+ {\csname\ekvd@unknown@choice@name{#1}{#2}\endcsname{#3}}%
+ {\ekvd@err{invalid choice `#3' (`#2', set `#1')}}%
}
}
\begingroup
diff --git a/macros/generic/expkv-def/expkv-def.pdf b/macros/generic/expkv-def/expkv-def.pdf
index ec3bf9fac9..f051a5fe6a 100644
--- a/macros/generic/expkv-def/expkv-def.pdf
+++ b/macros/generic/expkv-def/expkv-def.pdf
Binary files differ
diff --git a/macros/generic/expkv-opt/README.md b/macros/generic/expkv-opt/README.md
index 762484ed12..c92161eb5a 100644
--- a/macros/generic/expkv-opt/README.md
+++ b/macros/generic/expkv-opt/README.md
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv-opt -- parse class and package options with expkv
-Version 2020-07-02 v0.1
+Version 2020-07-04 v0.1a
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
diff --git a/macros/generic/expkv-opt/expkv-opt.dtx b/macros/generic/expkv-opt/expkv-opt.dtx
index d65c194f33..511cf6bf08 100644
--- a/macros/generic/expkv-opt/expkv-opt.dtx
+++ b/macros/generic/expkv-opt/expkv-opt.dtx
@@ -481,8 +481,8 @@ and the derived files expkv-opt.pdf
% \begin{macro}{\ekvoVersion,\ekvoDate}
% Store the packages version and date in two macros.
% \begin{macrocode}
-\newcommand*\ekvoVersion{0.1}
-\newcommand*\ekvoDate{2020-07-02}
+\newcommand*\ekvoVersion{0.1a}
+\newcommand*\ekvoDate{2020-07-04}
% \end{macrocode}
% \end{macro}
% And we report who we are and what we need.
@@ -532,21 +532,13 @@ and the derived files expkv-opt.pdf
%
% \subsection{Tests}
%
-% \begin{macro}[internal]{\ekvo@fi@firstoftwo,\ekvo@fi@gobble}
-% These two macros are just fast branching macros.
-% \begin{macrocode}
-\long\def\ekvo@fi@firstoftwo\fi\@secondoftwo#1#2{\fi#1}
-\long\def\ekvo@fi@gobble\fi\@firstofone#1{\fi}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}[internal]{\ekvo@ifx@TF,\ekvo@ifx@F}
% We'll need branching |\ifx| tests so that user input containing unbalanced
% \TeX\ ifs doesn't break (at least not because of us, everything else is the
% fault of \LaTeXe).
% \begin{macrocode}
-\def\ekvo@ifx@TF#1#2{\ifx#1#2\ekvo@fi@firstoftwo\fi\@secondoftwo}
-\def\ekvo@ifx@F#1#2{\ifx#1#2\ekvo@fi@gobble\fi\@firstofone}
+\def\ekvo@ifx@TF#1#2{\ifx#1#2\ekv@fi@firstoftwo\fi\@secondoftwo}
+\def\ekvo@ifx@F#1#2{\ifx#1#2\ekv@fi@gobble\fi\@firstofone}
% \end{macrocode}
% \end{macro}
%
@@ -558,7 +550,7 @@ and the derived files expkv-opt.pdf
% \begin{macrocode}
\protected\def\ekvo@do@with@set#1#2%
{%
- \ekv@ifdefined{\ekv@undefined@set{#1}}%
+ \ekvifdefinedset{#1}%
{%
\expandafter
\let\expandafter\ekvo@name\csname\ekv@undefined@set{#1}\endcsname
diff --git a/macros/generic/expkv-opt/expkv-opt.pdf b/macros/generic/expkv-opt/expkv-opt.pdf
index a7eb27e408..47257e50d3 100644
--- a/macros/generic/expkv-opt/expkv-opt.pdf
+++ b/macros/generic/expkv-opt/expkv-opt.pdf
Binary files differ
diff --git a/macros/generic/expkv/README.md b/macros/generic/expkv/README.md
index e3d5114c8a..c885f8a0d0 100644
--- a/macros/generic/expkv/README.md
+++ b/macros/generic/expkv/README.md
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
# expkv -- an expandable key=val implementation
-Version 2020-07-02 v1.3
+Version 2020-07-04 v1.4
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
diff --git a/macros/generic/expkv/expkv.dtx b/macros/generic/expkv/expkv.dtx
index 12cf70fd87..f804e6ee0f 100644
--- a/macros/generic/expkv/expkv.dtx
+++ b/macros/generic/expkv/expkv.dtx
@@ -429,6 +429,14 @@ and the derived files expkv.pdf
% |\relax|.
% \end{function}
%
+% \begin{function}{\ekvifdefinedset}
+% \begin{syntax}
+% \cs{ekvifdefinedset}\marg{set}\marg{true}\marg{false}
+% \end{syntax}
+% This macro tests whether \set\ is defined (which it is if at least one key
+% was defined for it). If it is \meta{true} will be run, else \meta{false}.
+% \end{function}
+%
% \begin{function}{\ekvbreak,\ekvbreakPreSneak,\ekvbreakPostSneak}
% \begin{syntax}
% \cs{ekvbreak}\marg{after}
@@ -1002,8 +1010,8 @@ and the derived files expkv.pdf
% \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.3}
-\def\ekvDate{2020-07-02}
+\def\ekvVersion{1.4}
+\def\ekvDate{2020-07-04}
% \end{macrocode}
% \end{macro}
%
@@ -1029,18 +1037,23 @@ and the derived files expkv.pdf
% \begin{macro}[internal]
% {
% \@gobble,\@firstofone,\@firstoftwo,\@secondoftwo,
-% \ekv@gobbleto@stop,\ekv@fi@secondoftwo,\ekv@gobble@mark,
-% \ekv@gobble@from@mark@to@stop
+% \ekv@gobbleto@stop,\ekv@fi@gobble,\ekv@fi@firstoftwo,\ekv@fi@secondoftwo,
+% \ekv@gobble@mark,\ekv@gobble@from@mark@to@stop
% }
% Since branching tests are often more versatile than |\if...\else...\fi|
% constructs, we define helpers that are branching pretty fast. Also here are
% some other utility functions that just grab some tokens. The ones that are
-% also contained in \LaTeX\ don't use the |ekv| prefix.
+% also contained in \LaTeX\ don't use the |ekv| prefix. Not all of the ones
+% defined here are really needed by \expkv\ but are provided because packages
+% like \expkvd\ or \expkvo\ need them (and I don't want to define them in each
+% package which might need them).
% \begin{macrocode}
\long\def\@gobble#1{}
\long\def\@firstofone#1{#1}
\long\def\@firstoftwo#1#2{#1}
\long\def\@secondoftwo#1#2{#2}
+\long\def\ekv@fi@gobble\fi\@firstofone#1{\fi}
+\long\def\ekv@fi@firstoftwo\fi\@secondoftwo#1#2{\fi#1}
\long\def\ekv@fi@secondoftwo\fi\@firstoftwo#1#2{\fi#2}
\long\def\ekv@gobbleto@stop#1\ekv@stop{}
\def\ekv@gobble@mark\ekv@mark{}
@@ -1263,6 +1276,15 @@ and the derived files expkv.pdf
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ekvifdefinedset}
+% \begin{macrocode}
+\def\ekvifdefinedset#1%
+ {%
+ \ekv@ifdefined{\ekv@undefined@set{#1}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\ekvset}
% Set up |\ekvset|, which should not be affected by active commas and equal
% signs. The equal signs are a bit harder to cope with and we'll do that later,
diff --git a/macros/generic/expkv/expkv.pdf b/macros/generic/expkv/expkv.pdf
index 0a28843fd4..627341a78f 100644
--- a/macros/generic/expkv/expkv.pdf
+++ b/macros/generic/expkv/expkv.pdf
Binary files differ