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
|
# -*- CPERL -*-
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Package;
use LaTeXML::Util::Pathname;
use Cwd qw(cwd abs_path);
DeclareOption('report',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption('book',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption('chapter',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption('part',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption('showignores',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption('extrefs',sub {PassOptions('sref','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption(undef,sub {PassOptions('article','cls',ToString(Digest(T_CS('\CurrentOption')))); });
ProcessOptions();
LoadClass('article');
RequirePackage('sref');
RegisterNamespace('omdoc'=>"http://omdoc.org/ns");
RegisterNamespace('om'=>"http://www.openmath.org/OpenMath");
RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML");
RegisterNamespace('dc'=>"http://purl.org/dc/elements/1.1/");
RegisterNamespace('cc'=>"http://creativecommons.org/ns");
RegisterNamespace('stex'=>"http://kwarc.info/ns/sTeX");
RegisterNamespace('ltx'=>"http://dlmf.nist.gov/LaTeXML");
RelaxNGSchema('omdoc+ltxml',
'#default'=>"http://omdoc.org/ns",
'om'=>"http://www.openmath.org/OpenMath",
'm'=>"http://www.w3.org/1998/Math/MathML",
'dc'=>"http://purl.org/dc/elements/1.1/",
'cc'=>"http://creativecommons.org/ns",
'ltx'=>"http://dlmf.nist.gov/LaTeXML",
'stex'=>"http://kwarc.info/ns/sTeX");
RequirePackage('omdoc');
sub xmlBase {
my $baseuri = LookupValue('baseuri');
my $baselocal = LookupValue('baselocal');
my $cdir = abs_path(cwd());
$cdir =~ s/^$baselocal//;
my ($d,$f,$t) = pathname_split(LookupValue('SOURCEFILE'));
$t = '' if LookupValue('cooluri');
Tokenize($baseuri.$cdir.'/'.$f.$t); }
DefEnvironment('{document} OptionalKeyVals:omdoc',
"<omdoc:omdoc "
. "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')"
. "(?&Tokenize(&LookupValue('SOURCEBASE'))"
. "(xml:id='&Tokenize(&LookupValue('SOURCEBASE')).omdoc')()) "
. "?&Tokenize(&LookupValue('baseuri'))"
. "(xml:base='&xmlBase()')() "
. "?#locator(stex:srcref='#locator')()>"
. "#body"
."</omdoc:omdoc>",
beforeDigest=> sub { AssignValue(inPreamble=>0); },
afterDigest=> sub { $_[0]->getGullet->flush; return; });
1;
|