# -*- CPERL -*-
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Global;
use LaTeXML::Package;
RequirePackage('rdfmeta');
RequirePackage('workaddress');
sub FishOutMetadata {
my ($document,$keyvals)=@_;
foreach my $role(qw(creators contributors)) {
my $idlist_string=getKeyValue_noDelim($keyvals,$role);
my @ids = split(/,\s*/, $idlist_string);
foreach my $id(@ids) {
my $name = LookupValue('DCM_'.$id.'_name');
if ($name) {
my $prop_role = $role;
chop $prop_role if $prop_role;
$document->insertElement("dc:$prop_role",$name) if $role;
} else {print STDERR "Warning: no $role with 'id' $id !\n";}
}
}
return;}#$
DefEnvironment('{DCmetadata}[]', "#body");
DefConstructor('\DCMcreators{}',sub{
my ($document,$args,%properties) = @_;
my $keyval = LaTeXML::KeyVals->new('wa@person',T_BEGIN,T_END,('creators'=>$args));
FishOutMetadata($document,$keyval);
return;});
DefConstructor('\DCMcontributors{}',sub{
my ($document,$args,%properties) = @_;
my $keyval = LaTeXML::KeyVals->new('wa@person',T_BEGIN,T_END,('contributors'=>$args));
FishOutMetadata($document,$keyval);
return;});
DefConstructor('\DCMtitle{}',"#1");
DefConstructor('\DCMsubject{}',"#1");
DefConstructor('\DCMdescription{}',"#1");
DefConstructor('\DCMpublisher{}',"#1");
DefConstructor('\DCMdate{}',"#1");
DefConstructor('\DCMtype{}',"#1");
DefConstructor('\DCMidentifier{}{}',"#2");
DefConstructor('\DCMsource{}',"#1");
DefConstructor('\DCMlanguage{}',"#1");
DefConstructor('\DCMrelation{}',"#1");
DefConstructor('\DCMrights{}',"#1");
DefMacro('\DCMlicensenotice{}','\DCMrights{#1}');
DefMacro('\DCMcopyrightnotice{}{}','\DCMrights{Copyright {\copyright} #1: #2}');
DefConstructor('\cclicense{}',"#1");
DefConstructor('\attribution',"");
DefConstructor('\noncommercial',"");
DefConstructor('\sharealike',"");
DefConstructor('\noderivativeworks',"");
DefConstructor('\DCMabstract{}',"#1");
Tag('dc:description',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:date',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:creator',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:contributor',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:title',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:subject',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:publisher',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:type',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:identifier',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:language',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
Tag('dc:rights',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1);
RawTeX('
\def\ISOtimestamp{\count1=\time\divide\count1 by 60 % hours
\count2=\count1\multiply\count2 by 60% minutes in \count1 hours
\count3=\time\advance\count3 by -\count2 % minutes
\the\year -\ifnum\month>9\else0\fi\the\month-\ifnum\day>9\else0\fi\the\day
T\ifnum\count1>9\else0\fi\the\count1:\ifnum\count3>9\else0\fi\the\count3:00Z}
');
Tag('dc:title',afterOpen=>\&numberIt,afterClose=>\&locateIt);
1;