%%
%% This is file `metakeys.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% metakeys.dtx  (with options: `package')
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{metakeys}[2011/07/03 v0.9 Framework for Metadata Keys]
\newif\ifmetakeys@showmeta\metakeys@showmetafalse
\DeclareOption{showmeta}{\metakeys@showmetatrue}
\ProcessOptions
\RequirePackage{keyval}[1997/11/10]
\newcommand\addmetakey{\@ifstar\addmetakey@star\addmetakey@nostar}
\newcommand\addmetakey@star[3][]%
{\@ifnextchar[{\addmetakey@star@aux[#1]{#2}{#3}}{\addmetakey@star@aux[#1]{#2}{#3}[]}}
\def\addmetakey@star@aux[#1]#2#3[#4]{\metakeys@ext@clear@keys{#2}{#3}{#1}%
\metakeys@initialize@showkeys{#2}%
\define@key{#2}{#3}[#4]{\expandafter\gdef\csname #2@#3\endcsname{##1}}}
\newcommand\addmetakey@nostar[3][]%
{\metakeys@ext@showkeys{#2}{#3}\addmetakey@star[#1]{#2}{#3}}
\newcommand\metasetkeys[2]{\@nameuse{clear@#1@keys}\setkeys{#1}{#2}%
\ifmetakeys@showmeta%
\edef\@@keys{\@nameuse{#1@showkeys}}%
\metakeys@show@keys{#1}{\@for\@I:=\@@keys\do{\metakeys@show@keyval{#1}{\@I}}}%
\fi}
\newcommand\metakeys@ext@clear@keys[3]{\@metakeys@ext@clear@keys{#1}{#1@#2}{#3}}
\newcommand\@metakeys@ext@clear@keys[3]{\@ifundefined{clear@#1@keys}%
{\expandafter\gdef\csname clear@#1@keys\endcsname%
{\expandafter\gdef\csname #2\endcsname{#3}}}%
{\expandafter\g@addto@macro\csname clear@#1@keys\endcsname%
{\expandafter\gdef\csname #2\endcsname{#3}}}}
\newcommand\addmetalistkey{\@ifstar\addmetalistkey@star\addmetalistkey@nostar}
\newcommand\addmetalistkey@star[3][]{\metakeys@ext@clear@keys{#2}{#3}{#1}%
\metakeys@initialize@showkeys{#2}%
\expandafter\gdef\csname #2@#3s\endcsname{}
\define@key{#2}{#3}[#1]{%
\expandafter\ifx\csname #2@#3s\endcsname\@empty\expandafter\gdef\csname #2@#3s\endcsname{##1}%
\else\expandafter\xdef\csname #2@#3s\endcsname{\csname #2@#3s\endcsname,##1}%
\fi}}
\newcommand\addmetalistkey@nostar[3][]%
{\metakeys@ext@showkeys{#2}{#3}\addmetalistkey@star[#1]{#2}{#3}}
\newcommand\metakeys@initialize@showkeys[1]%
{\@ifundefined{#1@showkeys}{\expandafter\def\csname #1@showkeys\endcsname{}}{}}%
\newcommand\metakeys@ext@showkeys[2]{\@ifundefined{#1@showkeys}%
{\expandafter\def\csname #1@showkeys\endcsname{#2}}%
{\expandafter\edef\csname #1@showkeys\endcsname{\csname #1@showkeys\endcsname,#2}}}
\newcommand\@metakeys@show@key[2]{\metakeys@show@key{#2}{#1}}
\newcommand\metakeys@show@key[2]{\edef\@test{#2}\ifx\@test\@empty\else #1:#2\quad\fi}
\newcommand\metakeys@show@keys[2]{\marginpar{{\scriptsize #2}}}
\newcommand\metakeys@show@keyval[2]%
{\expandafter\@metakeys@show@key\csname #1@#2\endcsname{#2}}
\newcommand\showmetakeys{\metakeys@showmetatrue}
\newcommand\hidemetakeys{\metakeys@showmetafalse}
\newcommand\addmetakeynew[3][]{\metakeys@ext@clear@keys{#2}{#3}{#1}%
\define@key{#2}{#3}{\expandafter\gdef\csname #2@#3\endcsname{##1}}}
\newcommand\metakeys@unspecified{an metakeys-defined key left unspecified}
\newcommand\metakeysifus[4]{\message{testing #1@#2=\csname#1@#2\endcsname}%
\expandafter\ifx\csname #1@#2\endcsname\metakeys@unspecified{#3}\else{#4}\fi}
\endinput
%%
%% End of file `metakeys.sty'.
