diff options
author | Karl Berry <karl@freefriends.org> | 2010-07-20 22:30:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-07-20 22:30:22 +0000 |
commit | cdfe96a3444a4d0664b9702c4ff6fe6622257834 (patch) | |
tree | 577232accd4bf41d7480fae7c177ceef147c8fea /Master/texmf-dist/tex/latex/stex/dcm | |
parent | 47e2d96a8faed88dfedd17ca5352227d585a6710 (diff) |
stex update once more
git-svn-id: svn://tug.org/texlive/trunk@19548 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/dcm')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/dcm/dcm.sty | 175 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml | 160 |
2 files changed, 335 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty new file mode 100644 index 00000000000..a7cf322fcaf --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty @@ -0,0 +1,175 @@ +%% +%% This is file `dcm.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% dcm.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{dcm}[2010/06/25 v0.3 Dublin Core Metadata] +\RequirePackage{sref} +\omdaddkey{dcm@person}{id} +\omdaddkey{dcm@person}{birthdate} +\omdaddkey{dcm@person}{email} +\omdaddkey{dcm@person}{url} +\omdaddkey{dcm@person}{affiliation} +\omdaddkey{dcm@person}{personaltitle} +\omdaddkey{dcm@person}{academictitle} +\omdaddkey{dcm@person}{department} +\omdaddkey{dcm@person}{workaddress} +\omdaddkey{dcm@person}{privaddress} +\omdaddkey{dcm@person}{worktel} +\omdaddkey{dcm@person}{privtel} +\omdaddkey{dcm@person}{workfax} +\omdaddkey{dcm@person}{privfax} +\omdaddkey{dcm@person}{worktelfax} +\omdaddkey{dcm@person}{privtelfax} +\def\dcm@pers@def#1#2{\expandafter\xdef\csname dcm@person@\dcm@person@id @#1\endcsname{#2}} +\def\dcm@pers@ref#1#2{\csname dcm@person@#1@#2\endcsname} +\let\dcm@persons=\relax +\newcommand{\DCMperson}[2][]{\omdsetkeys{dcm@person}{#1} +\ifx\dcm@person@id\@empty\@latex@warning{key 'id' undefined in DCMperson}\else +\dcm@pers@def{name}{#2} +\dcm@pers@def{email}{\dcm@person@email} +\dcm@pers@def{birthdate}{\dcm@person@birthdate} +\dcm@pers@def{url}{\dcm@person@url} +\dcm@pers@def{affiliation}{\dcm@person@affiliation} +\dcm@pers@def{workaddress}{\dcm@person@workaddress} +\dcm@pers@def{privaddress}{\dcm@person@privaddress} +\dcm@pers@def{personaltitle}{\dcm@person@personaltitle} +\dcm@pers@def{academictitle}{\dcm@person@academictitle} +\dcm@pers@def{department}{\dcm@person@department} +\dcm@pers@def{workaddress}{\dcm@person@workaddress} +\dcm@pers@def{privaddress}{\dcm@person@privaddress} +\dcm@pers@def{worktel}{\dcm@person@worktel} +\dcm@pers@def{privtel}{\dcm@person@privtel} +\dcm@pers@def{workfax}{\dcm@person@workfax} +\dcm@pers@def{privfax}{\dcm@person@privfax} +\dcm@pers@def{worktelfax}{\dcm@person@worktelfax} +\dcm@pers@def{privtelfax}{\dcm@person@privtelfax} +\@ifundefined{dcm@persons}{\xdef\dcm@persons{\dcm@person@id}}{\xdef\dcm@persons{\dcm@persons,\dcm@person@id}} +\fi} +\newenvironment{DCmetadata}[1][]% +{\def\@style{#1}} % to set the way things are presented. +{\@ifundefined{dcm@\@style @block}{\message{style {\@style} not defined}}{\csname dcm@\@style @block\endcsname}} +\def\dc@mtabline#1#2{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line&\dcm@pers@ref\@p{#2}}} +\tab@line} +\def\dcm@atabline#1#2#3{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line: \dcm@pers@ref\@p{#3}}} +\tab@line} +\def\dcm@bitabline#1#2#3#4{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line&\dcm@pers@ref\@p{#2} #3 \dcm@pers@ref\@p{#4}}} +\tab@line} +\def\DCMcreators#1{\@for\@I:=#1\do{% +\ifx\csname dcm@person@\@I @id\endcsname\@empty% undefined \dcm@person@id +\PackageError{dcm}{reference to undefined DCMperson \@I}% +{you must define a person with id=\@I\MessageBreak% +via the macro \protect\DCMperson, before you can use it in \protect\DCMcreators}\fi}% +\def\dcm@creators{#1}} +\def\DCMcontributors#1{\@for\@I:=#1\do{% +\ifx\csname dcm@person@\@I @id\endcsname\@empty% undefined \dcm@person@id +\PackageError{dcm}{reference to undefined DCMperson \@I}% +{you must define a person with id=\@I\MessageBreak% +via the macro \protect\DCMperson, before you can use it in \protect\DCMcontributors}}% +\else% all \dcm@person@id in the list are defined +\def\dcm@contributors{#1}\fi} +\def\DCMtitle#1{\def\dcm@title{#1}\providecommand{\dcm@shorttitle}{#1}} +\def\dcm@subtitle{} +\def\DCMsubtitle#1{\def\dcm@subtitle{#1}} +\def\dcm@shorttitle{} +\def\DCMshorttitle#1{\def\dcm@shorttitle{#1}} +\def\DCMsubject#1{\def\dcm@subject{#1}} +\long\def\DCMdescription#1{\long\def\dcm@description{#1}} +\def\DCMpublisher#1{\def\dcm@publisher{#1}} +\def\dcm@date{\today} +\def\DCMdate#1{\def\dcm@date{#1}} +\def\DCMtype#1{\def\dcm@type{#1}} +\def\DCMidentifier#1#2{\def\dcm@scheme{#1}\def\dcm@identifier{#2}} +\def\DCMsource#1{\def\dcm@source{#1}} +\def\DCMlanguage#1{\def\dcm@language{#1}} +\def\DCMrelation#1{\def\dcm@relation{#1}} +\def\DCMrights#1{\long\def\dcm@rights{#1}} +\def\DCMlicense#1{\def\dcm@license{#1}} +\def\dcm@license{All rights reserved} +\def\DCMlicensenotice#1{\long\def\dcm@license{\\[1ex]License: #1}} +\def\DCMcopyrightnotice#1#2{\DCMrights{Copyright {\copyright} #1: #2}} +\def\cclicense#1{\def\attribution{\def\dcm@by{yes}} + \def\noncommercial{\def\dcm@nc{yes}} + \def\sharealike{\defdcm@sharealike{yes}} + \def\noderivativeworks{\def\dcm@derivatives{no}}} +\long\def\DCMabstract#1{\long\def\dcm@abstract{#1}} +\def\dcm@authorblock{\newcounter{authors}\stepcounter{authors} +{\let\tabularnewline\relax + \@for\@I:=\dcm@creators\do{\stepcounter{authors}} + \def\@authors{}\def\@affs{}\def\@urls{} + \@for\@I:=\dcm@creators\do + {\xdef\@authors{\@authors&\csname dcm@person@\@I @name\endcsname} + \xdef\@affs{\@affs&\csname dcm@person@\@I @affiliation\endcsname} + \xdef\@urls{\@urls&\csname dcm@person@\@I @url\endcsname}} + \message{authors: \@authors}} + \begin{tabular}[t]{l*{\theauthors}{c}}\@authors\\\@affs\\\@urls\end{tabular}} +\def\dcm@titlepage@block{\begin{titlepage} + \null\vfil\vskip 60\p@ + \begin{center} + \ifx\dcm@title\@empty + \PackageWarning{dcm}{No title specified}{\LARGE Add title here\par} + \else\LARGE \dcm@title \par\fi + \ifx\dcm@subtitle\@empty + \vskip 3em\Large \dcm@subtitle \par\vskip 3em + \else\large\lineskip .75em\dcm@authorblock\vskip 1.5em\fi + \ifx\dcm@date\@empty + \PackageWarning{dcm}{No date specified}{\large\today\par} + \else{\large\dcm@date\par}\vskip 2em\fi + \end{center}\vskip2em + \ifx\dcm@abstract\@empty + \PackageWarning{dcm}{No Abstract specified}\else + \begin{quote}\textbf\dcm@abstract@heading:\dcm@abstract\end{quote}\fi + \vskip 2em\par\vfil\noindent + {\small\noindent\dcm@rights\dcm@license} + \end{titlepage}} +\def\dcm@maketitle@block{\def\@title{\dcm@title\ifx\dcm@subtitle\empty\else\newline\dcm@subtitle\fi} +\def\@author{\dcm@authorblock}\def\@date{\dcm@date}\maketitle} +\srefaddidkey{dcm@sect} +\omdaddkey{dcm@sect}{short} +\omdaddkey{dcm@sect}{creators} +\omdaddkey{dcm@sect}{contributors} +\def\dcm@section#1#2#3{\def\dcm@sect@type{#1}\omdsetkeys{dcm@sect}{#3}\sref@target% +\ifx\dcm@sect@short\@empty\csname #1\endcsname{#2}% +\else\csname #1\endcsname[\dcm@sect@short]{#2}\fi~% +\@ifundefined{sect@style} % +{\dcm@section@default@style{#1}}% +{\csname dcm@section@\sect@style @style\endcsname{#1}}} +\def\dcm@section@default@style#1{% +\ifx\dcm@sect@creators\@empty\else% +\textbf{\dcm@creators@heading}:% +\@for\@I:=\dcm@sect@creators\do{~\csname dcm@person@\@I @name\endcsname}\fi% +\ifx\dcm@sect@contributors\@empty\else% there are contributors +\dcm@contributors@connector% +\@for\@I:=\dcm@sect@contributors\do{~\csname dcm@person@\@I @name\endcsname}\\\fi} +\newcommand{\DCMchapter}[2][]% +{\dcm@section{chapter}{#2}{#1}\sref@label@id{\dcm@chapter@heading\ \thechapter}} +\newcommand{\DCMsection}[2][]% +{\dcm@section{section}{#2}{#1}\sref@label@id{\dcm@section@heading\ \thesection}} +\newcommand{\DCMsubsection}[2][]% +{\dcm@section{subsection}{#2}{#1}\sref@label@id{\dcm@subsection@heading\ \thesubsection}} +\newcommand{\DCMsubsubsection}[2][]% +{\dcm@section{subsubsection}{#2}{#1}\sref@label@id{\dcm@subsubsection@heading\ \thesubsubsection}} +\newcommand{\DCMparagraph}[2][]% +{\dcm@section{paragraph}{#2}{#1}\sref@label@id{this \dcm@paragraph@heading}} +\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} +\def\dcm@abstract@heading{Abstract} +\def\dcm@creators@heading{Author(s)} +\def\dcm@contributors@connector{with contributions from} +\def\dcm@chapter@heading{Chapter} +\def\dcm@section@heading{Section} +\def\dcm@subsection@heading{Subsection} +\def\dcm@subsubsection@heading{Subsubsection} +\endinput +%% +%% End of file `dcm.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml new file mode 100644 index 00000000000..c4dbe33283e --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml @@ -0,0 +1,160 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Global; +use LaTeXML::Package; +RequirePackage('sref'); + sub getKeyValue_noDelim { + my ($keyval,$key)=@_; + my $valuelist = 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('DCM_'.$id.'_email',$email,'global') if $email; + AssignValue('DCM_'.$id.'_affiliation',$affill,'global') if $affill; + AssignValue('DCM_'.$id.'_address',$email,'global') if $email; + AssignValue('DCM_'.$id.'_url',$url,'global') if $url; + AssignValue('DCM_'.$id.'_name',$name,'global') if $name; + } else {print STDERR "Warning: key 'id' undefined in \\DCMperson\n"}; + return;} +DefKeyVal('dcm@person','id','Semiverbatim'); +DefKeyVal('dcm@person','birthdate','Semiverbatim'); +DefKeyVal('dcm@person','email','Semiverbatim'); +DefKeyVal('dcm@person','url','Semiverbatim'); +DefKeyVal('dcm@person','affiliation','Semiverbatim'); +DefKeyVal('dcm@person','personaltitle','Semiverbatim'); +DefKeyVal('dcm@person','academictitle','Semiverbatim'); +DefKeyVal('dcm@person','department','Semiverbatim'); +DefKeyVal('dcm@person','workaddress','Semiverbatim'); +DefKeyVal('dcm@person','privaddress','Semiverbatim'); +DefKeyVal('dcm@person','worktel','Semiverbatim'); +DefKeyVal('dcm@person','privtel','Semiverbatim'); +DefKeyVal('dcm@person','workfax','Semiverbatim'); +DefKeyVal('dcm@person','privfax','Semiverbatim'); +DefKeyVal('dcm@person','worktelfax','Semiverbatim'); +DefKeyVal('dcm@person','privtelfax','Semiverbatim'); + +DefConstructor('\DCMperson OptionalKeyVals:dcm@person {}','', +beforeDigest=> sub { AssignValue(inPreamble=>0); }, +afterDigest=>sub { + my ($stomach,$whatsit)=@_; + my $keys=$whatsit->getArg(1); + my $name=ToString($whatsit->getArg(2)); + $keys->setValue('name',$name); + ExportMetadata($keys); + return; +});#$ +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('dcm@person',T_BEGIN,T_END,('creators'=>$args)); + FishOutMetadata($document,$keyval); + return;}); +DefConstructor('\DCMcontributors{}',sub{ + my ($document,$args,%properties) = @_; + my $keyval = LaTeXML::KeyVals->new('dcm@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('omdoc:omgroup', autoClose=>1); +DefConstructor('\DCMchapter OptionalKeyVals:omgroup {}',sub { + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:chapter',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:section',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsubsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:subsection',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsubsubsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:subsubsection',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMparagraph OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:paragraph',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +Tag('omdoc:chapter',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:section',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subsection',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subsubsection',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:paragraph',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subparagraph',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>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 -\the\month-\the\day T\the\count1:\the\count3:00Z}'); +Tag('dc:title',afterOpen=>\&numberIt,afterClose=>\&locateIt); +1; |