summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml
blob: cdd386bbc6f18b0c320617e1813fd55714fa54d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- 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}[]', "<omdoc:metadata>#body</omdoc:metadata>");
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{}',"<dc:title>#1</dc:title>");
DefConstructor('\DCMsubject{}',"<dc:subject>#1</dc:subject>");
DefConstructor('\DCMdescription{}',"<dc:description>#1</dc:description>");
DefConstructor('\DCMpublisher{}',"<dc:publisher>#1</dc:publisher>");
DefConstructor('\DCMdate{}',"<dc:date>#1</dc:date>");
DefConstructor('\DCMtype{}',"<dc:type>#1</dc:type>");
DefConstructor('\DCMidentifier{}{}',"<dc:identifier scheme='#1'>#2</dc:identifier>");
DefConstructor('\DCMsource{}',"<dc:source>#1</dc:source>");
DefConstructor('\DCMlanguage{}',"<dc:language>#1</dc:language>");
DefConstructor('\DCMrelation{}',"<dc:relation>#1</dc:relation>");
DefConstructor('\DCMrights{}',"<dc:rights>#1</dc:rights>");
DefMacro('\DCMlicensenotice{}','\DCMrights{#1}');
DefMacro('\DCMcopyrightnotice{}{}','\DCMrights{Copyright {\copyright} #1: #2}');
DefConstructor('\cclicense{}',"<cc:license>#1</cc:license>");
DefConstructor('\attribution',"<cc:attribution/>");
DefConstructor('\noncommercial',"<cc:noncommercial/>");
DefConstructor('\sharealike',"<cc:sharealike/>");
DefConstructor('\noderivativeworks',"<cc:noderivativeworks>");
DefConstructor('\DCMabstract{}',"<dc:description>#1</dc:description>");
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;