diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty | 202 |
1 files changed, 131 insertions, 71 deletions
diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty index 4996acf58b3..a09335b6b03 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-view.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'skeyval-view.sty', version 1.2, 2013/02/10. % +% This is file 'skeyval-view.sty', version 1.3, 2013/05/15. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -18,10 +18,11 @@ % The following files constitute the skeyval bundle and must be % % distributed as a whole: % % % -% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, % -% and skeyval-testpkg.sty. % +% skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, % +% skeyval-view-pokayoke1. % % % % Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% @@ -69,12 +70,12 @@ \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{skeyval-view} - [2013/02/10 v1.2 Viewer utility for skeyval package (AM)] + [2013/05/15 v1.3 Viewer utility for skeyval package (AM)] \@ifpackageloaded{skeyval}{}{\RequirePackage{skeyval}} \directkeys*{% .path=SKVV/skvview, .holder prefix=skvv@, - .initialize keys after define, + .initialize keys after define=false, .every unknown option={ \PackageWarning{skeyval-view}{Unknown option '\CurrentOption' ignored}% }, @@ -84,13 +85,19 @@ .ord/{xcolor-options,load-xcolor-with}// \edef\skvv@xcoloroptions{\unexpanded{#1}} \skvstripouterbraces{1}\skvv@xcoloroptions, + .bool/tabulate/true + }, + .execute options={ + tabulate=true,xcolor-options=false,load-xcolor-with=false }, - .copy class options and process options, + .copy class options and process options } +\skvnewregisters\toks{\skvv@toksa} \AtEndOfPackage{% - \skvdisablekeys[SKVV]{skvview}{% - xcolor-options,load-xcolor-with - }% + \let\ifskvv@tempsw\ifskvv@tabulate + \skvv@tabulatefalse + \skvdisablekeys[SKVV]{skvview}{xcolor-options,load-xcolor-with}% + \let\ifskvv@tabulate\ifskvv@tempsw } \@ifpackageloaded{longtable}{}{\RequirePackage{longtable}} @@ -102,7 +109,7 @@ \directkeys*{ .path=SKVV/skvview, .holder prefix=skvv@, - .initialize after define=false, + .initialize keys after define=false, .define keys={ .ord/{file,wcolsep,weol}/\@nil/ \skvcsedef{skvv@\skvcurrentkey}{\unexpanded{#1}} @@ -115,7 +122,7 @@ \skvaftercsname\skvcsvnormalize{skvv@\skvcurrentkey} , .bool/{view,vlabels,wlabels}/true, - .ord/length of default/20/\def\skvv@lod{#1}, + .ord/length of default/20/\def\skvv@lengthofdefa{#1}, .cmd/color/black, }, .set keys={ @@ -147,87 +154,121 @@ \skvrobustdef*\setupviewkeys{\skvsetkeys[SKVV]{skvview}} \let\skvv@db\@empty -\skvrobustdef*\skvv@tabulate#1#2#3{% - \edef\skv@tempa{\detokenize{#3}}% - \skv@getbasetoks\skvv@lod\skv@tempa\skv@ival - \skvxaddtolist{,}\skvv@db{% - #1=\ifx\skvcurrentprefix\@empty\else - \skvcurrentprefix\fi=\skvcurrentfamily=#2=\skv@ival - }% +\skvrobustdef*\skvv@dotabulate#1#2#3{% + \ifskvv@tabulate + \begingroup + \edef\skv@tempa{\detokenize{#3}}% + \skv@getshortformofcontent\skvv@lengthofdefa\skv@tempa\skv@ival + \skvxaddtolist{,}\skvv@db{% + #1=\ifx\skvcurrentprefix\@empty\else + \skvcurrentprefix\fi=\skvcurrentfamily=#2=\skv@ival + }% + \skvaftergroupdef\skvv@db\endgroup + \fi } -\protected\def\skv@ordkey@a#1[#2]#3{% - % Pointers have been stripped in \skv@ordkey. - \skvifstrcmpTF{#2}{^skv^}{% - \skvv@tabulate{#1}{ordinary}{[none]}% +\protected\def\skv@ordkey@a#1#2[#3]#4{% + \skvifstrcmpTF{#3}{^skv^}{% + \skvv@dotabulate{#2}{ordinary}{[none]}% + }{% + \skv@definedefault{#2}{#3}% + \skvv@dotabulate{#2}{ordinary}{#3}% + }% + % Pointers on key #2 have been stripped in \skv@ordkey. + % The pointer '.hp' may be used to set a holder prefix for the key. + \skvxifinTF{\detokenize{.hp}}{\detokenize{#4}}{% + \def\skv@prova##1.hp##2##3\skv@ord@nil{% + \let\skv@gobble@or@iden\@iden + \edef\skv@hp{\unexpanded{##2}}% + \edef\skv@callback{\unexpanded{##1##3}}% + }% + \skv@prova#4\skv@ord@nil }{% - \skv@definedefault{#1}{#2}% - \skvv@tabulate{#1}{ordinary}{#2}% + \let\skv@gobble@or@iden\@gobble + \edef\skv@callback{\unexpanded{#4}}% + }% + \csname skvcs#1def\endcsname{\skv@header#2.@cbk}{% + % This can be called in #3 access the value of ordinary key. + % No prefix is used here, to reduce macro name: + \skv@gobble@or@iden{\skvcslet{\skv@hp#2}\noexpand\skvcurrentvalue}% + \skvexpandonce\skv@callback }% - \skvcsedef{\skv@header#1.@cbk}{\unexpanded{#3}}% } \protected\def\skv@cmdkey#1#2[#3]#4{% \skv@strippointersfromkey{#2}% \skvifdefboolTF{skv@st}{% \skv@definedefault\skvcurrentkey{#3}% - \skvv@tabulate\skvcurrentkey{command}{#3}% + \skvv@dotabulate\skvcurrentkey{command}{#3}% }{% - \skvv@tabulate\skvcurrentkey{command}{[none]}% + \skvv@dotabulate\skvcurrentkey{command}{[none]}% }% % This is to allow the key name to be expanded before possibly zapping % spaces in key name: \edef\skv@prova{#1\skvcurrentkey}% \edef\skv@prova{\expandafter\skv@zapornot\expandafter {\expandafter\skv@zapsw\expandafter}\expandafter{\skv@prova}}% - \skvcslet{\skv@header\skvcurrentkey.@hp}\skv@prova - \skvcsedef{\skv@header\skvcurrentkey.@cbk}{\unexpanded{#4}}% + \skvcsedef{\skv@header\skvcurrentkey.@cbk}{% + \skvcslet{\skv@prova}\noexpand\skvcurrentvalue + \unexpanded{#4}% + }% } \protected\def\skv@choicekey@g{% \skvcommaparse*\skv@currlist\skv@prova{% \skvexpbracenext\skv@strippointersfromkey\skv@prova \ifx\skv@default\skv@rej - \skvv@tabulate\skvcurrentkey{choice}{[none]}% - \else\skvafterfi + \skvv@dotabulate\skvcurrentkey{choice}{[none]}% + \else \skvexpanded{% - \noexpand\skvv@tabulate + \noexpand\skvv@dotabulate {\skvxonce\skvcurrentkey}{choice}{\skvxonce\skv@default}% \noexpand\skv@definedefault {\skvxonce\skvcurrentkey}{\skvxonce\skv@default}% }% \fi - \skvcsedef{\skv@header\skvcurrentkey.@hp}{\skv@hp\skvcurrentkey}% - \skvcsedef{\skv@header\skvcurrentkey.@cbk}{\the\skv@toksa}% + \skvcsedef{\skv@header\skvcurrentkey.@cbk}{% + \skvcslet{\skv@hp\skvcurrentkey}\noexpand\skvcurrentvalue + \the\skv@temptoks + }% }% } \protected\def\skv@boolkey@c#1#2#3#4{% - % Pointers have been stripped in \skv@boolkey. - \skvcsnewif{\skv@zapornot{\skv@zapsw}{#2}}% - \edef\skvv@boolortog{\if\skv@typetogkey toggle\else bool\fi}% + \if\skv@typetogkey + \skvdeftog{\skv@zapornot{\skv@zapsw}{#2}}% + \else + \skvcsnewif{\skv@zapornot{\skv@zapsw}{#2}}% + \fi \skvifdefboolTF{skv@st}{% \skv@definedefault{#1}{#3}% - \skvv@tabulate{#1}{\skvv@boolortog}{#3}% + \skvv@dotabulate{#1}{\if\skv@typetogkey toggle\else bool\fi}{#3}% }{% - \skvv@tabulate{#1}{\skvv@boolortog}{[none]}% + \skvv@dotabulate{#1}{\if\skv@typetogkey toggle\else bool\fi}{[none]}% }% \edef\skv@tempa##1##2{% \noexpand\skv@sttrue \ifskv@pl\noexpand\skv@pltrue\else\noexpand\skv@plfalse\fi \skv@checkchoice[\noexpand\skv@value]{##1}{true,false}##2% }% - \skv@toksa\expandafter{\skv@tempa{##1}{#4}}% - \skvcsedef{\skv@header#1.@cbk}{\the\skv@toksa}% + \skv@temptoks\expandafter{\skv@tempa{##1}{#4}}% + \skvcsedef{\skv@header#1.@cbk}{\the\skv@temptoks}% } -% #2: styles, #3: default, #4: callback -\protected\def\skv@appendstyles@a#1#2[#3]#4{% +% #2=styles, #3=default, #4=callback +\protected\def\skv@appendslots@a#1#2[#3]#4{% \skvcommaparse{#1}\skv@prova{% \skvexpbracenext\skv@strippointersfromkey\skv@prova \skvexpanded{% \skvifstrcmpTF{#3}{^skv^}{% - \skvv@tabulate{\skvcurrentkey}{style}{[none]}% + % When using \skvaddslots, signal keys will otherwise be added + % in the database twice (while treating prepended and appended + % slots). + \ifskv@addslots@appending\else + \skvv@dotabulate{\skvcurrentkey}{slot/style}{[none]}% + \fi }{% \skv@definedefault{\skvcurrentkey}{\unexpanded{#3}}% - \skvv@tabulate{\skvcurrentkey}{style}{\unexpanded{#3}}% + \ifskv@addslots@appending\else + \skvv@dotabulate{\skvcurrentkey}{slot/style}{\unexpanded{#3}}% + \fi }% - \skv@appendstyles@b{\skvcurrentkey}\unexpanded{{#2}{#4}}% + \skv@appendslots@b{\skvcurrentkey}\unexpanded{{#2}{#4}}% }% }% } @@ -238,7 +279,14 @@ \do\skvv@color\do\ifskvv@view\do\ifskvv@vlabels\do\ifskvv@wlabels }{2} -\skvrobustdef*\skvv@skvview@a#1{% +\skvnewdef*\skvv@@view{% + \ifskvv@tabulate + 0\ifskvv@view 0\else 1\fi + \else + 01% + \fi +} +\skvrobustdef*\skvv@skvview#1{% \skvsetkeys[SKVV]{skvview}{#1}% \ifx\skvv@default\@nnil\else\@onelevel@sanitize\skvv@default\fi \ifx\skvv@columns\@nnil @@ -246,21 +294,32 @@ \skvv@coliitrue\skvv@coliiitrue\skvv@colivtrue\skvv@colvtrue \else \skvsetnumber\skvv@nra\@ne - \@expandtwoargs\skvtestifin{,prefix,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@coliitrue\else\skvv@coliifalse\fi - \@expandtwoargs\skvtestifin{,family,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@coliiitrue\else\skvv@coliiifalse\fi - \@expandtwoargs\skvtestifin{,type,}{,\skvv@columns,}% - \ifin@ + \skvxifinTF{,prefix,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@coliitrue + }{% + \skvv@coliifalse + }% + \skvxifinTF{,family,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@coliiitrue + }{% + \skvv@coliiifalse + }% + \skvxifinTF{,type,}{,\skvv@columns,}{% \skvadvanceno\skvv@nra\@ne\skvv@colivtrue - \else - \@expandtwoargs\skvtestifin{,key type,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@colivtrue\else\skvv@colivfalse\fi - \fi - \@expandtwoargs\skvtestifin{,default,}{,\skvv@columns,}% - \ifin@\skvadvanceno\skvv@nra\@ne\skvv@colvtrue\else\skvv@colvfalse\fi + }{% + \skvxifinTF{,key type,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@colivtrue + }{% + \skvv@colivfalse + }% + }% + \skvxifinTF{,default,}{,\skvv@columns,}{% + \skvadvanceno\skvv@nra\@ne\skvv@colvtrue + }{% + \skvv@colvfalse + }% \fi - \ifskvv@view + \if\skvv@@view \protected@edef\skv@prova{% \noexpand\begin{longtable}[l]{*\skvv@nra l}% \\\noexpand\hline @@ -285,35 +344,37 @@ \\\noexpand\endfoot\noexpand\hline \noexpand\endlastfoot }% - \skv@toksa\expandafter{\skv@prova}% + \skvv@toksa\expandafter{\skv@prova}% + \fi + \ifx\skvv@file\@nnil\else + \immediate\openout\skvv@out\skvv@file \fi - \ifx\skvv@file\@nnil\else\immediate\openout\skvv@out\skvv@file\fi \skvcommaloop*\skvv@db\skv@prova{% \skv@swatrue - \expandafter\skvv@skvview@b\skv@prova\skv@nil + \expandafter\skvv@skvview@a\skv@prova\skv@nil }% - \ifskvv@view - \addto@hook\skv@toksa{\end{longtable}}% + \if\skvv@@view + \skvaddtotoks\skvv@toksa{\end{longtable}}% \begingroup \color{\skvv@color}% - \ttfamily\the\skv@toksa + \ttfamily\the\skvv@toksa \endgroup \fi \ifx\skvv@file\@nnil\else\immediate\closeout\skvv@out\fi } -\skvnewdef*\skvv@skvview@b#1=#2=#3=#4=#5\skv@nil{% +\skvnewdef*\skvv@skvview@a#1=#2=#3=#4=#5\skv@nil{% \skvv@ifin{#2}\skvv@prefix \skvv@ifin{#3}\skvv@family \skvv@ifin{#4}\skvv@type \skvv@ifin{#5}\skvv@default \ifskv@swa - \ifskvv@view + \if\skvv@@view \edef\skv@prova{% #1\ifskvv@colii\fi\ifskvv@coliii\fi \ifskvv@coliv\fi\ifskvv@colv\fi \ifskvv@vlabels\noexpand\label{#2/#3/#1}\fi }% - \skv@toksa\expandafter{\the\expandafter\skv@toksa\skv@prova\\}% + \skvoaddtotoks\skvv@toksa{\skv@prova\\}% \fi \ifx\skvv@file\@nnil\else \immediate\write\skvv@out{% @@ -332,7 +393,6 @@ \skvxifinTF{,\detokenize{#1},}{,\skvoxdetok{#2},}{}\skv@swafalse \fi } - \directkeys*{ .path=SKVV/skvvshow, .holder prefix=skvvs@, @@ -344,7 +404,7 @@ \skvstripouterbraces{2}\skvvs@show \ifx\skvvs@show\@empty\else\skvafterfi \skvpushstate\skvv@state\skvv@depth - \skvexpbracenext\skvv@skvview@a\skvvs@show + \skvexpbracenext\skvv@skvview\skvvs@show \skvpopstate\skvv@state\skvv@depth \fi }, |