From 13856e4dd2db3582850ceb88dc8e93a938078a35 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 9 Jan 2017 22:07:41 +0000 Subject: conv-xkv (9jan17) git-svn-id: svn://tug.org/texlive/trunk@42910 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty | 90 +++++++++++++++-------- 1 file changed, 59 insertions(+), 31 deletions(-) (limited to 'Master/texmf-dist/tex/latex/conv-xkv') diff --git a/Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty b/Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty index 74f879f0df5..0da4b2b044b 100644 --- a/Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty +++ b/Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty @@ -6,20 +6,20 @@ %% %% conv-xkv.dtx (with options: `copyright,package') %% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% conv-xkv package %% -%% Copyright (C) 2016 D. P. Story %% -%% dpstory@uakron.edu %% -%% %% -%% This program can redistributed and/or modified under %% -%% the terms of the LaTeX Project Public License %% -%% Distributed from CTAN archives in directory %% -%% macros/latex/base/lppl.txt; either version 1 of the %% -%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% conv-xkv package %% +%% Copyright (C) 2016--2017 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.2 of the %% +%% License, or (at your option) any later version. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{conv-xkv} - [2016/12/20 v1.0 convert xkeyval format (dps)] + [2017/01/09 v1.1b convert xkeyval format (dps)] \RequirePackage{xkeyval} \begingroup \@makeother\`% @@ -96,8 +96,7 @@ \def\DeclareDelimiter{\ckv@SetCatcodes\DeclareDelimiter@i} \def\DeclareDelimiter@i#1#2{\@ifundefined{kvdelim-#1} {\csarg\def{kvdelim-#1}{#2}\ckv@RestoreCatcodes\cxkvSetup{#1}} - {\ckv@RestoreCatcodes}% -} + {\ckv@RestoreCatcodes}} \@onlypreamble\DeclareDelimiter \newtoks\cxkv@tmptoks \cxkv@tmptoks={} \def\cxkv@dummy{dummy} @@ -107,17 +106,34 @@ \obeyspaces\gdef\cxkv@TAB{ } \egroup \def\cxkv@colon{colon} -\newcommand\cxkvsetkeys[1][colon]{% - \def\@rgi{#1}\ifx\@rgi\cxkv@colon\else - \InputIfFileExists{xkv-#1.cut} - {\PackageInfo{conv-xkv}{Inputting xkv-#1.cut}} - {\PackageInfo{conv-xkv}{Cannot find xkv-#1.cut}}\fi - \@nameuse{cxkvsetkeys-#1}} +\newcommand\cxkvsetkeys{% + \@ifnextchar({\cxkvsetkeys@i}{\cxkvsetkeys@i(colon)}} +\def\cxkvsetkeys@i(#1){\cxkvsetkeys@ii{#1}} +\def\cxkvsetkeys@ii#1{\def\cxkv@delimname{#1}\@ifstar + {\def\cxkv@skOpts{*}\cxkvsetkeys@iii} + {\def\cxkv@skOpts{}\cxkvsetkeys@iii}} +\newcommand\cxkvsetkeys@iii[2][]{\def\@rgi{#1}\ifx\@rgi\@empty + \expandafter\def\expandafter\cxkv@skOpts + \expandafter{\cxkv@skOpts{#2}}\else + \expandafter\def\expandafter + \cxkv@skOpts\expandafter{\cxkv@skOpts[#1]{#2}}\fi + \def\thisxkvF@mily{#2}\cxkvsetkeys@iv} +\newcommand\cxkvsetkeys@iv[2][]{\def\@rgi{#1}\ifx\@rgi\@empty\else + \expandafter\def\expandafter\cxkv@skOpts + \expandafter{\cxkv@skOpts[#1]}\fi + \expandafter\cxkvsetkeys@v\expandafter{\thisxkvF@mily}{#2}} +\def\cxkvsetkeys@v#1#2{\cxkv@skipfalse + \ifx\cxkv@delimname\cxkv@colon\else + \InputIfFileExists{xkv-\cxkv@delimname.cut} + {\PackageInfo{conv-xkv}{Inputting xkv-\cxkv@delimname.cut}} + {\PackageInfo{conv-xkv}{Cannot find xkv-\cxkv@delimname.cut}}\fi + \@nameuse{cxkvsetkeys-\cxkv@delimname}{#1}{#2}} \csarg\def{cxkvsetkeys-colon}#1#2{% - \def\thisxkvF@mily{#1}\def\cxkv@scratch{}\cxkv@tmptoks={}% - \@nameuse{cxkv@convertColoniiEqual-colon}#2,dummy:dummy,\@nil} -\csarg\def{cxkv@convertColoniiEqual-colon}#1:#2,#3\@nil{% - \cxkv@convertColoniiEquali{colon}{#1}{#2}{#3}} + \def\thisxkvF@mily{#1}\def\thisxkvV@lues{#2}\def\cxkv@scratch{}% + \cxkv@tmptoks={}% + \@nameuse{cxkv@cnvrtDelimniiEqual-colon}#2,dummy:dummy,\@nil} +\csarg\def{cxkv@cnvrtDelimniiEqual-colon}#1:#2,#3\@nil{% + \cxkv@cnvrtDelimniiEquali{colon}{#1}{#2}{#3}} \def\cxkvSetup#1{\bgroup \IfFileExists{xkv-#1.cut}{\PackageInfo{conv-xkv}{xkv-#1.cut already exists,\MessageBreak will not create another one}}{% @@ -126,18 +142,19 @@ \newwrite \cxkv@write \uccode`c=`\% \def\w{#1}\def\x{cxkvsetkeys-#1}% - \def\y{cxkv@convertColoniiEqual-#1}% + \def\y{cxkv@cnvrtDelimniiEqual-#1}% \def\z{kvdelim-#1}% \immediate\openout \cxkv@write xkv-#1.cut \immediate\write\cxkv@write{\string\makeatletter}% \uppercase{\immediate\write\cxkv@write{\string \csarg\string\def{\y}\cxkvarg1\@nameuse{\z}% \cxkvarg2,\cxkvarg3\string\@nil{c^^J\cxkv@TAB - \string\cxkv@convertColoniiEquali{\w}{\cxkvarg1}% + \string\cxkv@cnvrtDelimniiEquali{\w}{\cxkvarg1}% {\cxkvarg2}{\cxkvarg3}}}} \uppercase{\immediate\write\cxkv@write{\string\csarg\string\def {\x}\cxkvarg1\cxkvarg2{c^^J\cxkv@TAB \string\def\string\thisxkvF@mily{\cxkvarg1}\string + \def\string\thisxkvV@lues{\cxkvarg2}\string \let\string\cxkv@scratch\string\@empty\string \cxkv@tmptoks={}c^^J\cxkv@TAB \string\@nameuse{\y}\cxkvarg2,% @@ -152,7 +169,18 @@ \def\cxkv@parsecomma#1,#2\@nil{\def\@rgi{#1}\def\@rgii{#2}% \ifx\@rgii\@empty\cxkv@keyonlyfalse\else \cxkv@keyonlytrue\cxkv@removecomma#2\@nil\fi} -\def\cxkv@convertColoniiEquali#1#2#3#4{\def\cxkv@rgiii{#3}% +\newif\ifcxkv@skip \cxkv@skipfalse +\def\cxkv@cnvrtDelimniiEquali#1#2#3#4{% + \def\cxkv@rgiii{#3}\def\cxkv@rgiv{#4}% + \ifx\thisxkvV@lues\@empty\else + \ifx\cxkv@rgiv\@empty + \edef\cxkv@next{\noexpand + \setkeys\cxkv@skOpts{\thisxkvV@lues}}% + \cxkv@skiptrue + \fi + \fi + \let\thisxkvV@lues\@empty + \ifcxkv@skip\else \ifx\cxkv@rgiii\cxkv@dummy \cxkv@parsecomma#2,\@nil \ifcxkv@keyonly @@ -160,10 +188,10 @@ \cxkv@tmptoks=\expandafter{\cxkv@tmp}% \edef\cxkv@scratch{\the\cxkv@tmptoks}% \edef\cxkv@next{\noexpand - \setkeys{\thisxkvF@mily}{\the\cxkv@tmptoks}}% + \setkeys\cxkv@skOpts{\the\cxkv@tmptoks}}% \else \edef\cxkv@next{\noexpand - \setkeys{\thisxkvF@mily}{\the\cxkv@tmptoks}}% + \setkeys\cxkv@skOpts{\the\cxkv@tmptoks}}% \fi \else \cxkv@parsecomma#2,\@nil @@ -172,14 +200,14 @@ \cxkv@tmptoks=\expandafter{\cxkv@tmp}% \edef\cxkv@scratch{\the\cxkv@tmptoks}% \edef\cxkv@next{\noexpand - \@nameuse{cxkv@convertColoniiEqual-#1}\cxkv@key + \@nameuse{cxkv@cnvrtDelimniiEqual-#1}\cxkv@key \@nameuse{kvdelim-#1}#3,#4\noexpand\@nil} \else \cxkv@tmptoks=\expandafter{\cxkv@scratch,#2=#3}% \edef\cxkv@scratch{\the\cxkv@tmptoks}% \def\cxkv@next{% - \@nameuse{cxkv@convertColoniiEqual-#1}#4\@nil}\fi - \fi\cxkv@next + \@nameuse{cxkv@cnvrtDelimniiEqual-#1}#4\@nil}\fi + \fi\fi\cxkv@next } \ckv@RestoreCatcodes \endinput -- cgit v1.2.3