# -*- CPERL -*- package LaTeXML::Package::Pool; use strict; use LaTeXML::Global; use LaTeXML::Package; RequirePackage('sref'); sub getKeyValue_noDelim { my ($keyval,$key)=@_; my $valuelist = $keyval && ToString($keyval->getValue($key)); $valuelist =~ s/^{(.*)}$/$1/g if $valuelist; return $valuelist; } sub ExportMetadata { my $keys = shift; my($id, $email,$affill,$address,$url,$name)=$keys && map(getKeyValue_noDelim($keys,$_),qw(id email affiliation address url name)); if ($id) { AssignValue('WA_'.$id.'_email',$email,'global') if $email; AssignValue('WA_'.$id.'_affiliation',$affill,'global') if $affill; AssignValue('WA_'.$id.'_address',$email,'global') if $email; AssignValue('WA_'.$id.'_url',$url,'global') if $url; AssignValue('WA_'.$id.'_name',$name,'global') if $name; } else {print STDERR "Warning: key 'id' undefined in \\WAperson\n"}; return;}#$ DefKeyVal('wa@person','id','Semiverbatim'); DefKeyVal('wa@person','birthdate','Semiverbatim'); DefKeyVal('wa@person','email','Semiverbatim'); DefKeyVal('wa@person','url','Semiverbatim'); DefKeyVal('wa@person','affiliation','Semiverbatim'); DefKeyVal('wa@person','personaltitle','Semiverbatim'); DefKeyVal('wa@person','academictitle','Semiverbatim'); DefKeyVal('wa@person','department','Semiverbatim'); DefKeyVal('wa@person','workaddress','Semiverbatim'); DefKeyVal('wa@person','privaddress','Semiverbatim'); DefKeyVal('wa@person','worktel','Semiverbatim'); DefKeyVal('wa@person','privtel','Semiverbatim'); DefKeyVal('wa@person','workfax','Semiverbatim'); DefKeyVal('wa@person','privfax','Semiverbatim'); DefKeyVal('wa@person','worktelfax','Semiverbatim'); DefKeyVal('wa@person','privtelfax','Semiverbatim'); DefConstructor('\WAperson OptionalKeyVals:wa@person {}','', afterDigest=>sub { my ($stomach,$whatsit)=@_; my $keys=$whatsit->getArg(1); my $name=ToString($whatsit->getArg(2)); $keys->setValue('name',$name); ExportMetadata($keys); return; });#$ DefKeyVal('wa@institution','id','Semiverbatim'); DefKeyVal('wa@institution','url','Semiverbatim'); DefKeyVal('wa@institution','partof','Semiverbatim'); DefConstructor('\WAinstitution OptionalKeyVals:wa@institution {}','', afterDigest=>sub { my ($stomach,$whatsit)=@_; my $keys=$whatsit->getArg(1); my $name=ToString($whatsit->getArg(2)); $keys->setValue('name',$name); ExportMetadata($keys); return; });#$ 1;