texlive[56074] Master/texmf-dist: expkv-cs (8aug20)

commits+karl at tug.org commits+karl at tug.org
Sat Aug 8 23:05:00 CEST 2020


Revision: 56074
          http://tug.org/svn/texlive?view=revision&revision=56074
Author:   karl
Date:     2020-08-08 23:05:00 +0200 (Sat, 08 Aug 2020)
Log Message:
-----------
expkv-cs (8aug20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md
    trunk/Master/texmf-dist/doc/latex/expkv-cs/expkv-cs.pdf
    trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
    trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex

Modified: trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md	2020-08-08 21:04:43 UTC (rev 56073)
+++ trunk/Master/texmf-dist/doc/latex/expkv-cs/README.md	2020-08-08 21:05:00 UTC (rev 56074)
@@ -1,7 +1,7 @@
 -------------------------------------------------------------------------------
 # expkv-cs -- define expandable key=val macros using expkv
 
-Version 2020-04-29 v0.3
+Version 2020-08-08 v0.4
 
 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-cs/expkv-cs.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx	2020-08-08 21:04:43 UTC (rev 56073)
+++ trunk/Master/texmf-dist/source/latex/expkv-cs/expkv-cs.dtx	2020-08-08 21:05:00 UTC (rev 56074)
@@ -309,15 +309,35 @@
 %
 % \begin{function}{\ekvcSplitAndForward}
 %   \begin{syntax}
-%     \cs{ekvcSplit}\meta{cs_1}\meta{cs_2}\marg{primary keys}
+%     \cs{ekvcSplitAndForward}\meta{cs}\marg{after}\marg{primary keys}
 %   \end{syntax}
-%   This defines \meta{cs_1} to be a macro taking one mandatory argument which
+%   This defines \meta{cs} to be a macro taking one mandatory argument which
 %   should contain a \kv\ list. You can use as many primary keys as you want
-%   with this. The primary keys will be forwarded to \meta{cs_2} as braced
+%   with this. The primary keys will be forwarded to \meta{after} as braced
 %   arguments (as many as necessary for your primary keys). The order of the
-%   braced arguments will be the order of your primary key definitions.
+%   braced arguments will be the order of your primary key definitions. In
+%   \meta{after} you can use just a single control sequence, or some arbitrary
+%   stuff which will be left in the input stream before your braced values (with
+%   one set of braces stripped from \meta{after}), so both of the following
+%   would be fine:
+% \begin{lstlisting}
+% \ekvcSplitAndForward\foo\foo at aux{keyA = A, keyB = B}
+% \ekvcSplitAndForward\foo{\foo at aux{more args}}{keyA = A, keyB = B}
+% \end{lstlisting}
 % \end{function}
 %
+% \begin{function}{\ekvcSplitAndUse}
+%   \begin{syntax}
+%     \cs{ekvcSplitAndUse}\meta{cs}\marg{primary keys}
+%   \end{syntax}
+%   This will roughly do the same as |\ekvcSplitAndForward|, but instead of
+%   specifying what will be used after splitting the keys, \meta{cs} will use
+%   what follows the \kv\ list. So its syntax will be
+% \end{function}
+%   \begin{syntax}
+%     \meta{cs}\{\key=\val, \ldots\}\marg{after}
+%   \end{syntax}
+%
 % \subsubsection{Hash}
 %
 % The hash variants will provide the key values as a single argument in which
@@ -343,17 +363,31 @@
 %
 % \begin{function}{\ekvcHashAndForward}
 %   \begin{syntax}
-%     \cs{ekvcHashAndForward}\meta{cs_1}\meta{cs_2}\marg{primary keys}
+%     \cs{ekvcHashAndForward}\meta{cs}\marg{after}\marg{primary keys}
 %   \end{syntax}
-%   This defines \meta{cs_1} to be a macro taking one mandatory argument which
+%   This defines \meta{cs} to be a macro taking one mandatory argument which
 %   should contain a \kv\ list. You can use as many primary keys as you want.
 %   The primary keys will be forwarded as a single argument containing every key
-%   to the underlying macro. For the underlying macro \meta{cs_2} is used (so
-%   this will provide the key list as a single argument to \meta{cs_2}). In the
-%   underlying macro you can access the \val\ of a \key\ by using
-%   \texttt{\cs[no-index]{ekvcValue}\{\key\}\{\#1\}}.
+%   to \meta{after}. You can use a single macro for \meta{after} or use some
+%   arbitrary stuff, which will be left in the input stream before the hashed
+%   \kv\ list with one set of braces stripped. In the
+%   macro called in \meta{after} you can access the \val\ of a \key\ by using
+%   \texttt{\cs[no-index]{ekvcValue}\{\key\}\{\#1\}} (or whichever argument the
+%   hashed \kv\ list will be).
 % \end{function}
 %
+% \begin{function}{\ekvcHashAndUse}
+%   \begin{syntax}
+%     \cs{ekvcHashAndUse}\meta{cs}\marg{primary keys}
+%   \end{syntax}
+%   This will roughly do the same as |\ekvcHashAndForward|, but instead of
+%   specifying what will be used after hashing the keys, \meta{cs} will use what
+%   follows the \kv\ list. So its syntax will be
+% \end{function}
+%   \begin{syntax}
+%     \meta{cs}\{\key=\val, \ldots\}\marg{after}
+%   \end{syntax}
+%
 % \begin{function}{\ekvcValue}
 %   \begin{syntax}
 %     \cs{ekvcValue}\{\key\}\marg{key list}
@@ -361,10 +395,10 @@
 %   This is a safe (but slow) way to access your keys in a hash variant. \key\
 %   is the key which's \val\ you want to use out of the \meta{key list}.
 %   \meta{key list} should be the key list argument forwarded to your underlying
-%   macro by |\ekvcHash| or |\ekvcHashAndForward|. It will be tested whether the
-%   hash function to access that \key\ exists, the \key\ argument is not empty,
-%   and that the \meta{key list} really contains a \val\ of that \key. This
-%   macro needs exactly two steps of expansion.
+%   macro by |\ekvcHash|, |\ekvcHashAndForward|, or |\ekvcHashAndUse|. It will
+%   be tested whether the hash function to access that \key\ exists, the \key\
+%   argument is not empty, and that the \meta{key list} really contains a \val\
+%   of that \key. This macro needs exactly two steps of expansion.
 % \end{function}
 %
 % \begin{function}{\ekvcValueFast}
@@ -766,8 +800,8 @@
 % \begin{macro}{\ekvcVersion,\ekvcDate}
 % We're on our first input, so lets store the version and date in a macro.
 %    \begin{macrocode}
-\def\ekvcVersion{0.3}
-\def\ekvcDate{2020-04-29}
+\def\ekvcVersion{0.4}
+\def\ekvcDate{2020-08-08}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -832,21 +866,22 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\ekvcSplitAndForward}
+% \begin{macro}{\ekvcSplitAndUse}
 %   The first user macro we want to set up can be reused for
-%   \cs[no-index]{ekvcSplit}. We'll split this one up so that the test whether
-%   the macro is already defined doesn't run twice.
+%   \cs[no-index]{ekvcSplitAndForward} and \cs[no-index]{ekvcSplit}. We'll split
+%   this one up so that the test whether the macro is already defined doesn't
+%   run twice.
 %    \begin{macrocode}
-\protected\long\def\ekvcSplitAndForward#1#2#3%
+\protected\long\def\ekvcSplitAndUse#1#2%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
-      {\ekvcSplitAndForward@{#1}{#2}{#3}}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcSplitAndUse@#1{}{#2}}%
   }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[internal]{\ekvcSplitAndForward@}
+% \begin{macro}[internal]{\ekvcSplitAndUse@}
 %   The actual macro setting up things. We need to set some variables, forward
 %   the key list to |\ekvc at SetupSplitKeys|, and afterwards define the front
 %   facing macro to call |\ekvset| and put the initials and the argument sorting
@@ -853,7 +888,7 @@
 %   macro behind it. The internals |\ekvc at any@long|, |\ekvc at initials| and
 %   |\ekvc at keycount| will be set correctly by |\ekvc at SetupSplitKeys|.
 %    \begin{macrocode}
-\protected\long\def\ekvcSplitAndForward@#1#2#3%
+\protected\long\def\ekvcSplitAndUse@#1#2#3%
   {%
     \edef\ekvc at set{\string#1}%
     \ekvc at SetupSplitKeys{#3}%
@@ -868,6 +903,20 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%
+% \begin{macro}{\ekvcSplitAndForward}
+%   This just reuses |\ekvcSplitAndUse@| with a non-empty second argument,
+%   resulting in that argument to be called after the splitting.
+%    \begin{macrocode}
+\protected\long\def\ekvcSplitAndForward#1#2#3%
+  {%
+    \ekv at ifdefined{\expandafter\@gobble\string#1}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcSplitAndUse@#1{{#2}}{#3}}%
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\ekvcSplit}
 %   The first half is just |\ekvcSplitAndForward| then we define the macro to
 %   which the parsed key list is forwarded. There we need to allow for up to
@@ -876,10 +925,10 @@
 \protected\long\def\ekvcSplit#1#2#3%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
+      {\ekvc at err@already at defined#1}%
       {%
         \expandafter
-        \ekvcSplitAndForward@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
+        \ekvcSplitAndUse@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
         \ifnum\ekvc at keycount=0
           \def\ekvc at tmp##1##{}%
         \else
@@ -907,12 +956,12 @@
 %   These macros parse the list of keys and set up the key macros. First we need
 %   to initialise some macros and start |\ekvparse|.
 %    \begin{macrocode}
-\protected\long\def\ekvc at SetupSplitKeys#1%
+\protected\long\def\ekvc at SetupSplitKeys
   {%
     \ekvc at keycount=0
     \def\ekvc at any@long{}%
     \def\ekvc at initials{}%
-    \ekvparse\ekvc at err@value at required\ekvc at SetupSplitKeys@a{#1}%
+    \ekvparse\ekvc at err@value at required\ekvc at SetupSplitKeys@a
   }
 %    \end{macrocode}
 %   Then we need to step the key counter for each key. Also we have to check
@@ -1052,24 +1101,24 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\ekvcHashAndForward}
-%   |\ekvcHashAndForward| works just like |\ekvcSplitAndForward|.
+% \begin{macro}{\ekvcHashAndUse}
+%   |\ekvcHashAndUse| works just like |\ekvcSplitAndUse|.
 %    \begin{macrocode}
-\protected\long\def\ekvcHashAndForward#1#2#3%
+\protected\long\def\ekvcHashAndUse#1#2%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
-      {\ekvcHashAndForward@{#1}{#2}{#3}}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcHashAndUse@#1{}{#2}}%
   }
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[internal]{\ekvcHashAndForward@}
-%   This is more or less the same as |\ekvcHashAndForward@|. Instead of an empty
+%   This is more or less the same as |\ekvcSplitAndUse@|. Instead of an empty
 %   group we place a marker after the initials, we don't use the sorting macros
 %   of |split|, but instead pack all the values in one argument.
 %    \begin{macrocode}
-\protected\long\def\ekvcHashAndForward@#1#2#3%
+\protected\long\def\ekvcHashAndUse@#1#2#3%
   {%
     \edef\ekvc at set{\string#1}%
     \ekvc at SetupHashKeys{#3}%
@@ -1083,6 +1132,18 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\ekvcHashAndForward}
+%   |\ekvcHashAndForward| works just like |\ekvcSplitAndForward|.
+%    \begin{macrocode}
+\protected\long\def\ekvcHashAndForward#1#2#3%
+  {%
+    \ekv at ifdefined{\expandafter\@gobble\string#1}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcHashAndUse@#1{{#2}}{#3}}%
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\ekvcHash}
 %   |\ekvcHash| does the same as |\ekvcSplit|, but has the advantage of not
 %   needing to count arguments, so the definition of the internal macro is a bit
@@ -1091,10 +1152,10 @@
 \protected\long\def\ekvcHash#1#2#3%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
+      {\ekvc at err@already at defined#1}%
       {%
         \expandafter
-        \ekvcHashAndForward@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
+        \ekvcHashAndUse@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
         \ekvc at any@long\expandafter\def\csname ekvc@\string#1\endcsname##1{#3}%
       }%
   }
@@ -1292,7 +1353,7 @@
 % \end{macro}
 %
 % \begin{macro}{\ekvcValueSplit}
-%   This splits off a single version
+%   This splits off a single value.
 %    \begin{macrocode}
 \long\def\ekvcValueSplit#1#2#3%
   {%

Modified: trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex	2020-08-08 21:04:43 UTC (rev 56073)
+++ trunk/Master/texmf-dist/tex/generic/expkv-cs/expkv-cs.tex	2020-08-08 21:05:00 UTC (rev 56074)
@@ -35,8 +35,8 @@
 \else
   \expandafter\endinput
 \fi
-\def\ekvcVersion{0.3}
-\def\ekvcDate{2020-04-29}
+\def\ekvcVersion{0.4}
+\def\ekvcDate{2020-08-08}
 \csname ekvc at tmp\endcsname
 \expandafter\chardef\csname ekvc at tmp\endcsname=\catcode`\@
 \catcode`\@=11
@@ -55,13 +55,13 @@
   {%
     \unexpanded{#1}##1\unexpanded{#2}%
   }
-\protected\long\def\ekvcSplitAndForward#1#2#3%
+\protected\long\def\ekvcSplitAndUse#1#2%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
-      {\ekvcSplitAndForward@{#1}{#2}{#3}}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcSplitAndUse@#1{}{#2}}%
   }
-\protected\long\def\ekvcSplitAndForward@#1#2#3%
+\protected\long\def\ekvcSplitAndUse@#1#2#3%
   {%
     \edef\ekvc at set{\string#1}%
     \ekvc at SetupSplitKeys{#3}%
@@ -73,13 +73,19 @@
         \unexpanded\expandafter{\ekvc at initials{}#2}%
       }%
   }
+\protected\long\def\ekvcSplitAndForward#1#2#3%
+  {%
+    \ekv at ifdefined{\expandafter\@gobble\string#1}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcSplitAndUse@#1{{#2}}{#3}}%
+  }
 \protected\long\def\ekvcSplit#1#2#3%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
+      {\ekvc at err@already at defined#1}%
       {%
         \expandafter
-        \ekvcSplitAndForward@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
+        \ekvcSplitAndUse@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
         \ifnum\ekvc at keycount=0
           \def\ekvc at tmp##1##{}%
         \else
@@ -96,12 +102,12 @@
           {#3}%
       }%
   }
-\protected\long\def\ekvc at SetupSplitKeys#1%
+\protected\long\def\ekvc at SetupSplitKeys
   {%
     \ekvc at keycount=0
     \def\ekvc at any@long{}%
     \def\ekvc at initials{}%
-    \ekvparse\ekvc at err@value at required\ekvc at SetupSplitKeys@a{#1}%
+    \ekvparse\ekvc at err@value at required\ekvc at SetupSplitKeys@a
   }
 \protected\def\ekvc at SetupSplitKeys@a#1%
   {%
@@ -190,13 +196,13 @@
         \endgroup
       }%
   }
-\protected\long\def\ekvcHashAndForward#1#2#3%
+\protected\long\def\ekvcHashAndUse#1#2%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
-      {\ekvcHashAndForward@{#1}{#2}{#3}}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcHashAndUse@#1{}{#2}}%
   }
-\protected\long\def\ekvcHashAndForward@#1#2#3%
+\protected\long\def\ekvcHashAndUse@#1#2#3%
   {%
     \edef\ekvc at set{\string#1}%
     \ekvc at SetupHashKeys{#3}%
@@ -207,13 +213,19 @@
         \unexpanded\expandafter{\ekvc at initials\ekvc at stop#2}%
       }%
   }
+\protected\long\def\ekvcHashAndForward#1#2#3%
+  {%
+    \ekv at ifdefined{\expandafter\@gobble\string#1}%
+      {\ekvc at err@already at defined#1}%
+      {\ekvcHashAndUse@#1{{#2}}{#3}}%
+  }
 \protected\long\def\ekvcHash#1#2#3%
   {%
     \ekv at ifdefined{\expandafter\@gobble\string#1}%
-      {\ekvc at err@already at defined{#1}}%
+      {\ekvc at err@already at defined#1}%
       {%
         \expandafter
-        \ekvcHashAndForward@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
+        \ekvcHashAndUse@\expandafter#1\csname ekvc@\string#1\endcsname{#2}%
         \ekvc at any@long\expandafter\def\csname ekvc@\string#1\endcsname##1{#3}%
       }%
   }



More information about the tex-live-commits mailing list.