summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml')
-rw-r--r--Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml53
1 files changed, 53 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml
new file mode 100644
index 00000000000..866a6339f5b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml
@@ -0,0 +1,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;