diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx b/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx index 2dc41641530..5edf48780c5 100644 --- a/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx +++ b/Master/texmf-dist/source/latex/expkv-def/expkv-def.dtx @@ -171,6 +171,7 @@ and the derived files expkv-def.pdf \DoNotIndex{\@,\unexpanded,\string,\expanded,\dimexpr,\global,\glueexpr,\hbox} \DoNotIndex{\numexpr,\RequirePackage,\setbox,\the,\unless,\xdef,\@firstofone} \DoNotIndex{\@firstoftwo,\@gobble,\@secondoftwo,\meaning,\detokenize} +\DoNotIndex{\romannumeral,\^} \DoNotIndex{\ifcsname} \DoNotIndex{\ifx} \DoNotIndex{\ifdefined} @@ -362,7 +363,7 @@ and the derived files expkv-def.pdf % |\edef|. % \end{function} % -% \begin{function}{default,qdefault,edefault} +% \begin{function}{default,qdefault,odefault,fdefault,edefault} % \begin{syntax} % default \key\ = \marg{definition} \prefixes3223 % \end{syntax} @@ -370,11 +371,18 @@ and the derived files expkv-def.pdf % \key\ can be of any argument-grabbing kind, and when used without a \val\ % it will be passed \meta{definition} instead. The |qdefault| variant will % expand the \key's code once, so will be slightly quicker, but not change if -% you redefine \key. The |edefault| on the other hand fully expands the -% \key-code with \meta{definition} as its argument inside of an |\edef|. +% you redefine \key. |odefault| is just another name for |qdefault|. The +% |fdefault| version will expand the key code until a non-expandable token or +% a space is found, a space would be gobbled.\footnotemark{} The |edefault| on the other hand fully expands +% the \key-code with \meta{definition} as its argument inside of an |\edef|. % \end{function} +% \footnotetext +% {^^A +% For those familiar with \TeX-coding: This uses a +% \cs[no-index]{romannumeral}-expansion. +% } % -% \begin{function}{initial,oinitial,einitial} +% \begin{function}{initial,oinitial,finitial,einitial} % \begin{syntax} % initial \key\ = \{\val\} \prefixes3333 % \end{syntax} @@ -382,8 +390,11 @@ and the derived files expkv-def.pdf % taking \key. It'll just call the key-macro of \key\ and pass it \val. The % |einitial| variant will expand \val\ using an |\edef| expansion prior to % passing it to the key-macro and the |oinitial| variant will expand the first -% token in \val\ once. +% token in \val\ once. |finitial| will expand \val\ until a non-expandable +% token or a space is found, a space would be +% gobbled.\footnotemark % \end{function} +% \footnotetext{Again using \cs[no-index]{romannumeral}.} % % \begin{function}{bool,gbool,boolTF,gboolTF} % \begin{syntax} @@ -755,8 +766,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.6} -\def\ekvdDate{2020-10-12} +\def\ekvdVersion{0.7} +\def\ekvdDate{2020-12-28} % \end{macrocode} % \end{macro} % @@ -904,15 +915,11 @@ and the derived files expkv-def.pdf {% \ekvd@ifalso {% - \ekv@expB@unbraceA{\ekv@expB@unbraceA{\ekvd@add@noval{#1}}}% + \ekv@expargtwice{\ekvd@add@noval{#1}}% {\ekvchangeset{#2}}% \ekvd@assert@not@protected@also }% - {% - \ekv@expB@unbraceA - {\ekv@expB@unbraceA{\ekvdefNoVal\ekvd@set{#1}}}% - {\ekvchangeset{#2}}% - }% + {\ekv@expargtwice{\ekvdefNoVal\ekvd@set{#1}}{\ekvchangeset{#2}}}% }% }% } @@ -942,7 +949,7 @@ and the derived files expkv-def.pdf \ekvd@assert@not@long \ekvd@prot#1\ekvd@tmp{#3}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% + {\ekv@exparg{\ekvd@add@noval{#2}}\ekvd@tmp{}}% {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% }% }% @@ -964,7 +971,7 @@ and the derived files expkv-def.pdf {% \ekvd@prot\ekvd@long#1\ekvd@tmp##1{#3}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@val{#2}}{\ekvd@tmp{##1}}{}}% + {\ekv@exparg{\ekvd@add@val{#2}}{\ekvd@tmp{##1}}{}}% {\ekvlet\ekvd@set{#2}\ekvd@tmp}% }% }% @@ -974,35 +981,41 @@ and the derived files expkv-def.pdf % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekvd@type@default,\ekvd@t@default,\ekvd@t@qdefault} +% \begin{macro}[internal] +% { +% \ekvd@type@default,\ekvd@t@default,\ekvd@t@qdefault,\ekvd@t@odefault, +% \ekvd@t@fdefault +% } % |\ekvd@type@default| asserts there was an argument, also the key for which one % wants to set a default has to be already defined (this is not so important for % |default|, but |qdefault| requires is). If everything is good, |\edef| a % temporary macro that expands |\ekvd@set| and the |\csname| for the key, and in % the case of |qdefault| does the first expansion step of the key-macro. % \begin{macrocode} -\protected\long\def\ekvd@type@default#1#2#3% +\protected\long\def\ekvd@type@default#1#2#3#4% {% \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#2}% + \ekvifdefined\ekvd@set{#3}% {% \ekvd@assert@not@new \ekvd@assert@not@long \ekvd@prot\edef\ekvd@tmp {% \unexpanded\expandafter#1% - {\csname\ekv@name\ekvd@set{#2}\endcsname{#3}}% + {#2\csname\ekv@name\ekvd@set{#3}\endcsname{#4}}% }% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#2}}\ekvd@tmp{}}% - {\ekvletNoVal\ekvd@set{#2}\ekvd@tmp}% + {\ekv@exparg{\ekvd@add@noval{#3}}\ekvd@tmp{}}% + {\ekvletNoVal\ekvd@set{#3}\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#2}}% + {\ekvd@err@undefined@key{#3}}% }% } -\protected\def\ekvd@t@default{\ekvd@type@default{}} -\protected\def\ekvd@t@qdefault{\ekvd@type@default{\expandafter\expandafter}} +\protected\def\ekvd@t@default{\ekvd@type@default{}{}} +\protected\def\ekvd@t@qdefault{\ekvd@type@default{\expandafter\expandafter}{}} +\let\ekvd@t@odefault\ekvd@t@qdefault +\protected\def\ekvd@t@fdefault{\ekvd@type@default{}{\romannumeral`\^^@}} % \end{macrocode} % \end{macro} % @@ -1021,7 +1034,7 @@ and the derived files expkv-def.pdf \ekvd@prot\edef\ekvd@tmp {\csname\ekv@name\ekvd@set{#1}\endcsname{#2}}% \ekvd@ifalso - {\ekv@expB@unbraceA{\ekvd@add@noval{#1}}\ekvd@tmp{}}% + {\ekv@exparg{\ekvd@add@noval{#1}}\ekvd@tmp{}}% {\ekvletNoVal\ekvd@set{#1}\ekvd@tmp}% }% {\ekvd@err@undefined@key{#1}}% @@ -1030,28 +1043,31 @@ and the derived files expkv-def.pdf % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekvd@t@initial,\ekvd@t@oinitial,\ekvd@t@einitial} +% \begin{macro}[internal] +% {\ekvd@t@initial,\ekvd@t@oinitial,\ekvd@t@finitial,\ekvd@t@einitial} % \begin{macrocode} -\long\def\ekvd@type@initial#1#2#3% +\long\def\ekvd@type@initial#1#2#3#4% {% \ekvd@assert@arg {% - \ekvifdefined\ekvd@set{#2}% + \ekvifdefined\ekvd@set{#3}% {% \ekvd@assert@not@new \ekvd@assert@not@also \ekvd@assert@not@long \ekvd@assert@not@protected - #1{#3}% - \csname\ekv@name\ekvd@set{#2}\expandafter\endcsname\expandafter + #1{#2#4}% + \csname\ekv@name\ekvd@set{#3}\expandafter\endcsname\expandafter {\ekvd@tmp}% }% - {\ekvd@err@undefined@key{#2}}% + {\ekvd@err@undefined@key{#3}}% }% } -\def\ekvd@t@initial{\ekvd@type@initial{\def\ekvd@tmp}} -\def\ekvd@t@oinitial{\ekvd@type@initial{\ekv@expB@unbraceA{\def\ekvd@tmp}}} -\def\ekvd@t@einitial{\ekvd@type@initial{\edef\ekvd@tmp}} +\def\ekvd@t@initial{\ekvd@type@initial{\def\ekvd@tmp}{}} +\def\ekvd@t@oinitial{\ekvd@type@initial{\ekv@exparg{\def\ekvd@tmp}}{}} +\def\ekvd@t@einitial{\ekvd@type@initial{\edef\ekvd@tmp}{}} +\def\ekvd@t@finitial + {\ekvd@type@initial{\ekv@exparg{\def\ekvd@tmp}}{\romannumeral`\^^@}} % \end{macrocode} % \end{macro} % @@ -1346,7 +1362,7 @@ and the derived files expkv-def.pdf \edef\ekvd@tmp{\ekvd@set}% \expandafter\ekvd@type@meta@a\expandafter{\ekvd@tmp}{#7}{#2}% \ekvd@ifalso - {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\ekv@exparg{#3{#6}}{\ekvd@tmp#4}{#5}}% {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% }% }% @@ -1386,7 +1402,7 @@ and the derived files expkv-def.pdf {% \ekvd@type@meta@a#7{#2}% \ekvd@ifalso - {\ekv@expB@unbraceA{#3{#6}}{\ekvd@tmp#4}{#5}}% + {\ekv@exparg{#3{#6}}{\ekvd@tmp#4}{#5}}% {\csname ekvlet#1\endcsname\ekvd@set{#6}\ekvd@tmp}% }% }% @@ -1424,7 +1440,7 @@ and the derived files expkv-def.pdf {% \ekvd@if@not@already@choice{#1}% {% - \ekv@expB@unbraceA + \ekv@exparg {% \expandafter\ekvd@add@aux \csname\ekv@name\ekvd@set{#1}\endcsname{{##1}}{#1}% |