From 7db88bf8a9b681417a440914e376013b13457d13 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 20 Dec 2016 22:56:32 +0000 Subject: conv-xkv (20dec16) git-svn-id: svn://tug.org/texlive/trunk@42757 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty | 187 ++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty (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 new file mode 100644 index 00000000000..74f879f0df5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/conv-xkv/conv-xkv.sty @@ -0,0 +1,187 @@ +%% +%% This is file `conv-xkv.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{conv-xkv} + [2016/12/20 v1.0 convert xkeyval format (dps)] +\RequirePackage{xkeyval} +\begingroup + \@makeother\`% + \@makeother\=% + \edef\x{% + \edef\noexpand\x{% + \endgroup + \noexpand\toks@{% + \catcode 96=\noexpand\the\catcode`\noexpand\`\relax + \catcode 61=\noexpand\the\catcode`\noexpand\=\relax + }% + }% + \noexpand\x + }% +\x +\@makeother\` +\@makeother\= +\def\ckv@SetCatcodes{% + \@makeother\`% + \@makeother\=% + \@makeother\~% + \catcode`\$=3 % + \catcode`\&=4 % + \catcode`\^=7 % + \catcode`\_=8 % + \@makeother\|% + \@makeother\:% + \@makeother\(% + \@makeother\)% + \@makeother\[% + \@makeother\]% + \@makeother\/% + \@makeother\!% + \@makeother\<% + \@makeother\>% + \@makeother\.% + \@makeother\;% + \@makeother\+% + \@makeother\-% + \@makeother\"% + \@makeother\'% +} +\begingroup + \def\x#1{\catcode`\noexpand#1=\the\catcode`#1\relax}% + \xdef\ckv@RestoreCatcodes{% + \the\toks@ + \x\~% + \x\$% + \x\&% + \x\^% + \x\_% + \x\|% + \x\:% + \x\(% + \x\)% + \x\[% + \x\]% + \x\/% + \x\!% + \x\<% + \x\>% + \x\.% + \x\;% + \x\+% + \x\-% + \x\"% + \x\'% + }% +\endgroup +\ckv@SetCatcodes +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\csarg\def{kvdelim-colon}{:} +\def\usekvdelim#1{\@nameuse{kvdelim-#1}} +\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}% +} +\@onlypreamble\DeclareDelimiter +\newtoks\cxkv@tmptoks \cxkv@tmptoks={} +\def\cxkv@dummy{dummy} +\def\cxkv@dummyc{dummy,} +\bgroup + \catcode`\#=12\relax\gdef\cxkvarg{#} + \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}} +\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\cxkvSetup#1{\bgroup +\IfFileExists{xkv-#1.cut}{\PackageInfo{conv-xkv}{xkv-#1.cut + already exists,\MessageBreak will not create another one}}{% + \PackageInfo{conv-xkv}{Creating the file xkv-#1.cut + containing\MessageBreak required definitions}% + \newwrite \cxkv@write + \uccode`c=`\% + \def\w{#1}\def\x{cxkvsetkeys-#1}% + \def\y{cxkv@convertColoniiEqual-#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}% + {\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 + \let\string\cxkv@scratch\string\@empty\string + \cxkv@tmptoks={}c^^J\cxkv@TAB + \string\@nameuse{\y}\cxkvarg2,% + \cxkv@dummy\@nameuse{\z}\cxkv@dummy,\string\@nil}}} + \immediate\write\cxkv@write{\string\makeatother}% + \immediate\closeout \cxkv@write +}% +\egroup} +\newif\ifcxkv@keyonly \cxkv@keyonlyfalse +\def\cxkv@comma{,} +\def\cxkv@removecomma#1,\@nil{\def\cxkv@key{#1}} +\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}% + \ifx\cxkv@rgiii\cxkv@dummy + \cxkv@parsecomma#2,\@nil + \ifcxkv@keyonly + \edef\cxkv@tmp{\the\cxkv@tmptoks,\@rgi}% + \cxkv@tmptoks=\expandafter{\cxkv@tmp}% + \edef\cxkv@scratch{\the\cxkv@tmptoks}% + \edef\cxkv@next{\noexpand + \setkeys{\thisxkvF@mily}{\the\cxkv@tmptoks}}% + \else + \edef\cxkv@next{\noexpand + \setkeys{\thisxkvF@mily}{\the\cxkv@tmptoks}}% + \fi + \else + \cxkv@parsecomma#2,\@nil + \ifcxkv@keyonly + \edef\cxkv@tmp{\the\cxkv@tmptoks,\@rgi}% + \cxkv@tmptoks=\expandafter{\cxkv@tmp}% + \edef\cxkv@scratch{\the\cxkv@tmptoks}% + \edef\cxkv@next{\noexpand + \@nameuse{cxkv@convertColoniiEqual-#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 +} +\ckv@RestoreCatcodes +\endinput +%% +%% End of file `conv-xkv.sty'. -- cgit v1.2.3