diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/keyval2e/README | 124 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty | 196 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/keyval2e.tlpsrc | 0 |
5 files changed, 322 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/keyval2e/README b/Master/texmf-dist/doc/latex/keyval2e/README new file mode 100644 index 00000000000..6930b8fc2e7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/keyval2e/README @@ -0,0 +1,124 @@ +This is the README file for the keyval2e package. + +VERSION + +Version 0.0.1, August 2011 + +SUMMARY + +The keyval2e package provides lightweight and robust facilities for +creating and managing keys. Its machinery isn't as extensive as +that of, eg, ltxkeys package, but it is equally robust. Ease of +use and speed of processing are the two main motives of this package. +Some, indeed many, applications of the key-value syntax (while they +call for robustness) don't require the full armor of key-value +processing as found in, eg, the ltxkeys package. + +Ordinary, boolean, and choice keys can be created using only +one command (\kve@definekeys). Keys can be initialized (with +the command \kve@setdefaults) as soon as they are created. And +in any run the default values of keys can be used to set keys that +have no current values. The latter task is accomplished by the +command \kve@setafterdefaults, meaning 'set keys with the current +values after those without current values have been initialized/set +with their default values'. Normally, keys are set with the +re-entrant command \kve@setkeys. + +LICENSE + +Copyright (c) 2011 Ahmed Musa. + +This software is author-maintained. Permission is granted to copy, +distribute and/or modify this software under the terms of the +LaTeX Project Public License, version 1.3 or higher. This software +is provided 'as it is', without warranty of any kind, either +expressed or implied, including, but not limited to, the implied +warranties of merchantability and fitness for any particular purpose. + +RELATED PACKAGES + +keyval.sty, xkeyval.sty, ltxkeys + +AUTHOR + +Ahmed Musa (amusa22@gmail.com) + +USER COMMANDS + +\kve@definekeys[<pref>]{<fam>}{<key-1>/<defa-1>/<callback-1>,..., + <key-n>/<defa-n>/<callback-n>} + +\kve@setkeys[<pref>]{<fam>}[na]{<keyval pairs>} + +\kve@setdefaults[<pref>]{<fam>}[<na>] + +\kve@setafterdefaults[<pref>]{<fam>}[<na>]{<curr-keyval>} + +Here, <pref> is the optional key prefix, <fam> is the +mandatory family, and [<na>] is a comma-separated list +of keys that should be ignored, ie, not set in the current +run. Undefined keys are reported as undefined and are not +saved as 'remaining keys'. There are no 'undefined key +handlers' and no 'handled keys' (see the ltxkeys package +for these facilities). + +You can use #1 in <callback> to access the value of the current +key. Also the macros \currpref, \currfam, \currkey, \currval, +and \currkeyval are always available. + +The following macros are utilities: + +\kve@checkchoice{<teststring>}{<nominations>}{<nomatch>} + +The <nominations> have the syntax + +<nom-1>:<callback-1>,...,<nom-n>:<callback-n> + +Here, <callback-i> will be executed if <nom-i> matches <teststring>. +The first match found takes priority over subsequent matches. + +The action <nomatch> will be executed if <teststring> doesn't +match any of the <nom>'s. + +\kve@checkbool{<val>}{<true>}{<false>} + +This checks if <val> is an admissible value of a boolean, +namely, if it is in the set {true | false}. The text <true> will +be executed if <val> is valid; otherwise <false> will be executed. + +\kve@keyvalerr + +This is a parameterless command that uses \currkey and +\currval internally. It simply generates an error to indicate +that the current value of a key is invalid. It will indicate the +key name and the truncated version of the value that is invalid. + +EXAMPLES + +\kve@definekeys[KV]{fam}{% + % keya and keyb are boolean keys: + keya/true/\kve@checkbool{#1}{\def\result{OK}}\kve@keyvalerr, + keyb/false/\kve@checkbool{#1}{\usename{@tempswa#1}}\kve@keyvalerr, + % keyc is a choice key: + keyc/left/\kve@checkchoice{#1}{left:\let\x\flushleft, + right:\let\x\flushright}\kve@keyvalerr, + keyone/+/\csn@def{mp@keyone}{#1}, + keytwo/+/\csn@def{mp@keytwo}{#1}, + keythree/+/\csn@def{mp@keythree}{#1}, + keyfour/+/\csn@def{mp@keyfour}{#1} +} + +Now that the keys have been defined, set them with their default +values: + +\kve@setdefaults[KV]{fam} + +The following command says 'the current keys will be set with +the current values, after the defaults have been set up'. +Keys with current values will not be set with their default values: + +\def\mysetkeys#1{% + \ifblankTF{#1}{} + {\kve@setafterdefaults[KV]{fam}{#1}}% +} +\mysetkeys{keyone=+,keytwo=abc,keythree=+,keyfour=+}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty b/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty new file mode 100644 index 00000000000..36dbbe3786c --- /dev/null +++ b/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty @@ -0,0 +1,196 @@ +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +% % +% This is file 'keyval2e.sty', version 0.0.1, July 2011 % +% % +% This package and accompanying files may be distributed and/or % +% modified under the conditions of the LaTeX Project Public License, % +% either version 1.3 of this license or any later version. The latest % +% version of this license is in http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of LaTeX % +% version 2005/12/01 or later. % +% % +% The LPPL maintenance status of this software is 'author-maintained'. % +% % +% This software is provided 'as it is', without warranty of any kind, % +% either expressed or implied, including, but not limited to, the % +% implied warranties of merchantability and fitness for a particular % +% purpose. % +% % +% Copyright (c) 2011 Ahmed Musa (a.musa@rocketmail.com). % +% % +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% + +\@ifpackageloaded{catoptions}{}{\RequirePackage{catoptions}[2011/07/20]} +\UseNormalCatcodes +\StyleFilePurpose{Lightweight and robust key-value parser (AM)} +\StyleFileRCSInfo +$Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $ +\ProvidesPackage{keyval2e}[\StyleFileInfo] +\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\SetStyleFileMessages[kve@]{info}{warn}{err} +\robust@def*\kve@parse{\cpt@testopt\kve@parse@a,} +\robust@def*\kve@parse@a[#1]#2#3{% + \pushfunctions\kve@parse{\ifloopbreak,\kve@do,\kve@act}\cpt@csvdepth + \cpt@stfalse\cpt@csvnormalize[#1]{#2}% + \def\kve@act##1{#3}% + \def\kve@do##1#1{% + \edef\reserved@a{\unexpanded\expandafter{\@gobble##1}}% + \ifxTF\reserved@a\cpt@nnil{}{% + \expandafter\kve@act\expandafter{\reserved@a}\relax + \@nameuse{@\ifloopbreak second\else first\fi oftwo}% + {\kve@do.}{\gobble@to@sentinel\cpt@nil#1}% + }% + }% + \loopbreakfalse + \ifcsemptyTF\normalized@list{}{% + \expandafter\kve@do\expandafter.\normalized@list#1\cpt@nil#1% + }% + \popfunctions\kve@parse\cpt@csvdepth +} +% \kve@definekeys[<KV>]{<fam>}{<keya/defa/callback, ...>} +\robust@def*\kve@definekeys{\cpt@testopt\kve@d@finekeys{KV}} +\newletcs\kve@definekey\kve@definekeys +\robust@def*\kve@d@finekeys[#1]#2#3{% + \def\kve@rsvda##1{\csn@def{#1@#2@\currkey}####1{##1}}% + \csn@def{#1@#2@initialkeyvals}{}% + \def\kve@splita##1/{\def\currkey{##1}\kve@splitb.}% + \def\kve@splitb##1/##2/##3\kve@nil{% + \edef\currval{\unexpanded\expandafter{\@gobble##1}}% + \csn@edef{#1@#2@\currkey @default}{% + \cptmakecs{#1@#2@\currkey}{\expandcsonce\currval}% + }% + \kve@rsvda{##2}% + \letcstocsn\kve@tempa{#1@#2@initialkeyvals}% + \csn@edef{#1@#2@initialkeyvals}{% + \cptliststack,\kve@tempa\currkey=% + \oifstrcmpTF\currval{true}{false}{\expandcsonce\currval}% + }% + }% + \kve@parse{#3}{\kve@splita##1///\kve@nil}% +} +% \kve@setkeys[<KV>]{<fam>}[na]{<keyval>} +\robust@def*\kve@setkeys{\cpt@testopt\kve@setkeys@a{KV}} +\robust@def*\kve@setkeys@a[#1]#2{\cpt@testopt{\kve@setkeys@b{#1}{#2}}{}} +\robust@def*\kve@setkeys@b#1#2[#3]#4{% + \pushfunctions\kve@setkeys{\currpref,\currfam,\currkey,% + \currval,\currkeyval}\kve@keydepth + \def\currpref{#1}\def\currfam{#2}% + \edef\kve@na{\cptcommanormalize{#3}}% + \def\kve@splita##1={\def\currkey{##1}\kve@splitb.}% + \def\kve@splitb##1=##2\kve@nil{% + \edef\currval{\unexpanded\expandafter{\@gobble##1}}% + \edef\currkeyval{\expandcsonce\currkey=\expandcsonce\currval}% + \xifinsetTF{,\cptoxdetok\currkey,}{,\cptoxdetok\kve@na,} + {} + {\kve@setkeys@c{#1}{#2}}% + }% + \cpt@stfalse\cpt@kvnormalize[,]{#4}% + \expandafter\kve@parse\expandafter + {\normalized@list}{\kve@splita##1==\kve@nil}% + \popfunctions\kve@setkeys\kve@keydepth +} +\robust@def*\kve@setkeys@c#1#2{% + \ifcsndefTF{#1@#2@\currkey}{% + \ifcsemptyTF\currval{% + \begingroup + \csn@def{#1@#2@\currkey}##1{\toks@{\def\currval{##1}}}% + \csname#1@#2@\currkey @default\endcsname + \expandafter\endgroup\the\toks@ + }{}% + \csname#1@#2@\currkey\expandafter + \endcsname\expandafter{\currval}\relax + }{% + \kve@err{Key '\currkey' not defined} + {Key '\currpref,\currfam,\currkey' is undefined}% + }% +} +\robust@def*\kve@getkeynames#1{% + \def\kve@keynames{}% + \ifblankTF{#1}{}{% + \begingroup + \cpt@stfalse\cpt@kvnormalize[,]{#1}% + \def\kve@g@tkeynames##1=##2\kve@nil{% + \edef\kve@keynames{% + \cptliststack,\kve@keynames\cpttrimspaces{##1}% + }% + }% + \expandafter\kve@parse\expandafter + {\normalized@list}{\kve@g@tkeynames##1=\kve@nil}% + \postgroupdef\kve@keynames\endgroup + }% +} +% \kve@setdefaults[<KV>]{<fam>}[<na>] +\robust@def*\kve@setdefaults{\cpt@testopt\kve@s@tdefaults{KV}} +\robust@def*\kve@s@tdefaults[#1]#2{% + \cpt@testopt{\kve@s@td@faults{#1}{#2}}{}% +} +\robust@def*\kve@s@td@faults#1#2[#3]{% + \ifcsndefTF{#1@#2@initialkeyvals}{% + \cptexpanded{% + \kve@setkeys[#1]{#2}[#3] + {\expandcsnonce{#1@#2@initialkeyvals}}% + }% + }{% + \kve@err{No initial key values for family '#2'} + {No initial key-value pairs saved for '#1,#2'.}% + }% +} +% \kve@setafterdefaults[<KV>]{<fam>}[<na>]{<curr-keyval>} +\robust@def*\kve@setafterdefaults{% + \cpt@testopt\kve@s@tafterdefaults{KV}% +} +\robust@def*\kve@s@tafterdefaults[#1]#2{% + \cpt@testopt{\kve@s@taft@rdefaults{#1}{#2}}{}% +} +\robust@def*\kve@s@taft@rdefaults#1#2[#3]#4{% + \kve@getkeynames{#4}% + \letcstocsn\kve@tempa{#1@#2@initialkeyvals}% + \ifdefTF\kve@tempa{% + \cptexpanded{% + \kve@setkeys[#1]{#2}[\kve@keynames,#3] + {\expandcsonce\kve@tempa}% + \kve@setkeys[#1]{#2}[#3]{\unexpanded{#4}}% + }% + }{% + \kve@err{No initial key values for family '#2'} + {No initial key-value pairs saved for '#1,#2'.}% + }% +} +\robust@def*\kve@keyvalerr{% + \kve@getinnoval*[10]\currval + \kve@err{Invalid value '\innoval' for key '\currkey'} + {Key '\currkey' has an inadmissible value '\innoval'.}% +} +\robust@def*\kve@getinnoval{\cpt@teststopt\kve@g@tinnoval{10}} +\robust@def*\kve@g@tinnoval[#1]#2{% + \begingroup + \def\innoval{}\@tempcnta\z@pt + \def\siso@do##1{% + \advance\@tempcnta by1 + \ifnum\@tempcnta<#1\relax\edef\innoval{\innoval##1}\fi + }% + \cptexpandarg\siso@@loop + {\if@boolTF{cpt@st}\cptoxdetok\detokenize{#2}}% + \edef\innoval{\innoval\ifnum\@tempcnta>#1\string\ETC\fi}% + \postgroupdef\innoval\endgroup +} +\robust@def*\kve@checkbool#1#2#3{% + \lowercase{\xifinsetTF{,\cpttrimspaces{#1},}} + {,true,false,}{#2}{#3}% +} +\robust@def*\kve@checkchoice#1#2#3{% + \expandafter\cptswapfirstbraced\expandafter + {\romannumeral-`\q\cpttrimspace{#1}} + {\kve@ch@ckchoice#2,\cpt@mil:\cpt@mil,\cpt@nil}{#3}% +} +\robust@def*\kve@ch@ckchoice#1:#2,#3\cpt@nil#4#5{% + \ifblankTF{#3}{\unexpanded{#5}}{% + \xifstrcmpTF{\cpttrimspaces{#1}}{\unexpanded{#4}}{% + \unexpanded{#2}% + }{% + \kve@ch@ckchoice#3\cpt@nil{#4}{#5}% + }% + }% +} + +\endinput
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 933a6c62f58..5d92d70dca4 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -199,7 +199,7 @@ my @TLP_working = qw( jablantile jamtimes jeopardy jknapltx jmlr jneurosci jpsj junicode jura juraabbrev jurabib juramisc jurarsp js-misc jvlisting kalender karnaugh kastrup kerkis kerntest - keycommand keystroke kix kixfont + keycommand keystroke keyval2e kix kixfont knitting knittingpattern knuth koma-moderncvclassic koma-script kpfonts kurier l2picfaq l2tabu l2tabu-english l2tabu-french l2tabu-it l2tabu-spanish diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index a5907e2967b..6428ba255fd 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -340,6 +340,7 @@ depend jvlisting depend kerntest depend keycommand depend keystroke +depend keyval2e depend kix depend koma-moderncvclassic depend labbook diff --git a/Master/tlpkg/tlpsrc/keyval2e.tlpsrc b/Master/tlpkg/tlpsrc/keyval2e.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/keyval2e.tlpsrc |