add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import { AbstractInputJax } from '../core/InputJax.js';
import { OptionList } from '../util/Options.js';
import { MathDocument } from '../core/MathDocument.js';
import { MathItem } from '../core/MathItem.js';
import { FindAsciiMath } from './asciimath/FindAsciiMath.js';
export declare class AsciiMath<N, T, D> extends AbstractInputJax<N, T, D> {
static NAME: string;
static OPTIONS: OptionList;
protected findAsciiMath: FindAsciiMath<N, T, D>;
constructor(options: OptionList);
compile(math: MathItem<N, T, D>, _document: MathDocument<N, T, D>): any;
findMath(strings: string[]): import("../core/MathItem.js").ProtoItem<N, T>[];
}
+70
View File
@@ -0,0 +1,70 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsciiMath = void 0;
var InputJax_js_1 = require("../core/InputJax.js");
var AsciiMath_js_1 = require("./asciimath/mathjax2/input/AsciiMath.js");
var Options_js_1 = require("../util/Options.js");
var FindAsciiMath_js_1 = require("./asciimath/FindAsciiMath.js");
var AsciiMath = (function (_super) {
__extends(AsciiMath, _super);
function AsciiMath(options) {
var _this = this;
var _a = __read((0, Options_js_1.separateOptions)(options, FindAsciiMath_js_1.FindAsciiMath.OPTIONS, AsciiMath.OPTIONS), 3), find = _a[1], am = _a[2];
_this = _super.call(this, am) || this;
_this.findAsciiMath = _this.options['FindAsciiMath'] || new FindAsciiMath_js_1.FindAsciiMath(find);
return _this;
}
AsciiMath.prototype.compile = function (math, _document) {
return AsciiMath_js_1.LegacyAsciiMath.Compile(math.math, math.display);
};
AsciiMath.prototype.findMath = function (strings) {
return this.findAsciiMath.findMath(strings);
};
AsciiMath.NAME = 'AsciiMath';
AsciiMath.OPTIONS = __assign(__assign({}, InputJax_js_1.AbstractInputJax.OPTIONS), { FindAsciiMath: null });
return AsciiMath;
}(InputJax_js_1.AbstractInputJax));
exports.AsciiMath = AsciiMath;
//# sourceMappingURL=asciimath.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"asciimath.js","sourceRoot":"","sources":["../../ts/input/asciimath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,mDAAqD;AACrD,wEAAwE;AACxE,iDAA+D;AAI/D,iEAA2D;AAU3D;IAAwC,6BAAyB;IAuB/D,mBAAY,OAAmB;QAA/B,iBAIC;QAHK,IAAA,KAAA,OAAgB,IAAA,4BAAe,EAAC,OAAO,EAAE,gCAAa,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,IAAA,EAA9E,IAAI,QAAA,EAAE,EAAE,QAAsE,CAAC;gBACvF,kBAAM,EAAE,CAAC;QACT,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,IAAI,gCAAa,CAAC,IAAI,CAAC,CAAC;;IAChF,CAAC;IAOM,2BAAO,GAAd,UAAe,IAAuB,EAAE,SAAgC;QACtE,OAAO,8BAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IAKM,4BAAQ,GAAf,UAAgB,OAAiB;QAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAtCa,cAAI,GAAW,WAAW,CAAC;IAK3B,iBAAO,yBAChB,8BAAgB,CAAC,OAAO,KAC3B,aAAa,EAAE,IAAI,IACnB;IAgCJ,gBAAC;CAAA,AA7CD,CAAwC,8BAAgB,GA6CvD;AA7CY,8BAAS"}
+19
View File
@@ -0,0 +1,19 @@
import { AbstractFindMath } from '../../core/FindMath.js';
import { OptionList } from '../../util/Options.js';
import { ProtoItem } from '../../core/MathItem.js';
export declare type EndItem = [string, boolean, RegExp];
export declare type Delims = [string, string];
export declare class FindAsciiMath<N, T, D> extends AbstractFindMath<N, T, D> {
static OPTIONS: OptionList;
protected start: RegExp;
protected end: {
[name: string]: EndItem;
};
protected hasPatterns: boolean;
constructor(options: OptionList);
protected getPatterns(): void;
protected addPattern(starts: string[], delims: Delims, display: boolean): void;
protected findEnd(text: string, n: number, start: RegExpExecArray, end: EndItem): ProtoItem<N, T>;
protected findMathInString(math: ProtoItem<N, T>[], n: number, text: string): void;
findMath(strings: string[]): ProtoItem<N, T>[];
}
+91
View File
@@ -0,0 +1,91 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindAsciiMath = void 0;
var FindMath_js_1 = require("../../core/FindMath.js");
var string_js_1 = require("../../util/string.js");
var MathItem_js_1 = require("../../core/MathItem.js");
var FindAsciiMath = (function (_super) {
__extends(FindAsciiMath, _super);
function FindAsciiMath(options) {
var _this = _super.call(this, options) || this;
_this.getPatterns();
return _this;
}
FindAsciiMath.prototype.getPatterns = function () {
var _this = this;
var options = this.options;
var starts = [];
this.end = {};
options['delimiters'].forEach(function (delims) { return _this.addPattern(starts, delims, false); });
this.start = new RegExp(starts.join('|'), 'g');
this.hasPatterns = (starts.length > 0);
};
FindAsciiMath.prototype.addPattern = function (starts, delims, display) {
var _a = __read(delims, 2), open = _a[0], close = _a[1];
starts.push((0, string_js_1.quotePattern)(open));
this.end[open] = [close, display, new RegExp((0, string_js_1.quotePattern)(close), 'g')];
};
FindAsciiMath.prototype.findEnd = function (text, n, start, end) {
var _a = __read(end, 3), display = _a[1], pattern = _a[2];
var i = pattern.lastIndex = start.index + start[0].length;
var match = pattern.exec(text);
return (!match ? null : (0, MathItem_js_1.protoItem)(start[0], text.substr(i, match.index - i), match[0], n, start.index, match.index + match[0].length, display));
};
FindAsciiMath.prototype.findMathInString = function (math, n, text) {
var start, match;
this.start.lastIndex = 0;
while ((start = this.start.exec(text))) {
match = this.findEnd(text, n, start, this.end[start[0]]);
if (match) {
math.push(match);
this.start.lastIndex = match.end.n;
}
}
};
FindAsciiMath.prototype.findMath = function (strings) {
var math = [];
if (this.hasPatterns) {
for (var i = 0, m = strings.length; i < m; i++) {
this.findMathInString(math, i, strings[i]);
}
}
return math;
};
FindAsciiMath.OPTIONS = {
delimiters: [['`', '`']],
};
return FindAsciiMath;
}(FindMath_js_1.AbstractFindMath));
exports.FindAsciiMath = FindAsciiMath;
//# sourceMappingURL=FindAsciiMath.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"FindAsciiMath.js","sourceRoot":"","sources":["../../../ts/input/asciimath/FindAsciiMath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,sDAAwD;AAExD,kDAAkD;AAClD,sDAA4D;AAkB5D;IAA4C,iCAAyB;IA2BnE,uBAAY,OAAmB;QAA/B,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,WAAW,EAAE,CAAC;;IACrB,CAAC;IAMS,mCAAW,GAArB;QAAA,iBAOC;QANC,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,IAAI,MAAM,GAAa,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAC,MAAc,IAAK,OAAA,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAtC,CAAsC,CAAC,CAAC;QAC1F,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;IASS,kCAAU,GAApB,UAAqB,MAAgB,EAAE,MAAc,EAAE,OAAgB;QACjE,IAAA,KAAA,OAAgB,MAAM,IAAA,E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C,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzD,IAAI,KAAK,EAAE;gBACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACjB,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;aACpC;SACF;IACH,CAAC;IAOM,gCAAQ,GAAf,UAAgB,OAAiB;QAC/B,IAAI,IAAI,GAAsB,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC9C,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5C;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAtGa,qBAAO,GAAe;QAClC,UAAU,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;KACzB,CAAC;IAsGJ,oBAAC;CAAA,AA7GD,CAA4C,8BAAgB,GA6G3D;AA7GY,sCAAa"}
@@ -0,0 +1 @@
export var LegacyAsciiMath: any;
@@ -0,0 +1,39 @@
MathJax = Object.assign(global.MathJax || {}, require("../legacy/MathJax.js").MathJax);
//
// Load component-based configuration, if any
//
if (MathJax.config && MathJax.config.asciimath) {
MathJax.Hub.Config({AsciiMath: MathJax.config.asciimath});
}
MathJax.Ajax.Preloading(
"[MathJax]/jax/input/AsciiMath/config.js",
"[MathJax]/jax/input/AsciiMath/jax.js",
"[MathJax]/jax/element/mml/jax.js"
);
require("../legacy/jax/element/mml/jax.js");
require("../legacy/jax/input/AsciiMath/config.js");
require("../legacy/jax/input/AsciiMath/jax.js");
require("../legacy/jax/element/MmlNode.js");
var MmlFactory = require("../../../../core/MmlTree/MmlFactory.js").MmlFactory;
var factory = new MmlFactory();
exports.LegacyAsciiMath = {
Compile: function (am,display) {
var script = {
type: "math/asciimath",
innerText: am,
MathJax: {}
};
var node = MathJax.InputJax.AsciiMath.Translate(script).root.toMmlNode(factory);
node.setInheritedAttributes({}, display, 0, false);
return node;
},
Translate: function (am,display) {
return this.Compile(am,display);
}
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
(function () {
var MML = MathJax.ElementJax.mml;
MML.mbase.Augment({
toJSON: function () {
var m = this.data.length;
var json = {type: this.type};
if (this.inferred) json.inferred = true;
if (this.isToken) {
json.text = this.data.join("");
} else {
json.children = new Array(m);
for (var i = 0; i < m; i++) {
var child = this.data[i];
if (child) json.children[i] = child.toJSON();
}
}
this.jsonAddAttributes(json);
return json;
},
jsonAddAttributes: function (json) {
var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults);
var names = (this.attrNames||MML.copyAttributeNames),
skip = MML.skipAttributes,
copy = MML.copyAttributes;
var attr = {};
if (!this.attrNames) {
for (var id in defaults) {
if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
if (this[id] != null && this[id] !== defaults[id]) {
if (this.Get(id,null,1) !== this[id]) attr[id] = this[id];
}
}
}
}
for (var i = 0, m = names.length; i < m; i++) {
if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
value = (this.attr||{})[names[i]];
if (value == null) value = this[names[i]];
if (value != null) attr[names[i]] = value;
}
json.attributes = attr;
}
});
MML.chars.Augment({
toJSON: function () {
return this.data.join("");
}
});
MML.entity.Augment({
toJSON: function () {
return this.data.join("");
}
});
MML.msubsup.Augment({
toJSON: function () {
var json = this.SUPER(arguments).toJSON.call(this);
if (this.data[this.sub] == null) {
json.type = "msup";
json.children.splice(1,1);
}
if (this.data[this.sup] == null) {
json.type = "msub";
json.children.splice(2,1);
}
return json;
}
});
MML.munderover.Augment({
toJSON: function () {
var json = this.SUPER(arguments).toJSON.call(this);
if (this.data[this.munder] == null) {
json.type = "mover";
json.children.splice(1,1);
}
if (this.data[this.mover] == null) {
json.type = "munder";
json.children.splice(2,1);
}
return json;
}
});
MML.TeXAtom.Augment({
toJSON: function () {
var json = this.SUPER(arguments).toJSON.call(this);
json.type = "mrow";
json.TeXAtom = MML.TEXCLASSNAMES[this.Get("texClass")];
return json;
}
});
MML.xml.Augment({
toJSON: function () {
return {type:"xml", data: this.toString()};
}
});
})();
@@ -0,0 +1,109 @@
(function () {
var MML = MathJax.ElementJax.mml;
var PROPERTY = [
'texWithDelims',
'movesupsub',
'subsupOK',
'primes',
'movablelimits',
'scriptlevel',
'open',
'close',
'isError',
'multiline',
'variantForm',
'autoOP',
'fnOP'
];
var RENAME = {
texWithDelims: 'withDelims'
};
MML.mbase.Augment({
toMmlNode: function (factory) {
var kind = this.type;
if (kind === 'texatom') kind = 'TeXAtom';
var node = this.nodeMake(factory, kind);
if ("texClass" in this) node.texClass = this.texClass;
return node;
},
nodeMake: function (factory,kind) {
var node = factory.MML[kind === 'TeXmathchoice' ? 'mathchoice' : kind]();
var data = (this.data[0] && this.data[0].inferred && this.inferRow ? this.data[0].data : this.data);
for (var i = 0, m = data.length; i < m; i++) {
var child = data[i];
if (child) node.appendChild(child.toMmlNode(factory));
}
this.nodeAddAttributes(node);
this.nodeAddProperties(node);
return node;
},
nodeAddAttributes: function (node) {
var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults);
var names = (this.attrNames||MML.copyAttributeNames),
skip = MML.skipAttributes,
copy = MML.copyAttributes;
if (!this.attrNames) {
for (var id in defaults) {
if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
if (this[id] != null && this[id] !== defaults[id]) {
if (this.Get(id,null,1) !== this[id]) node.attributes.set(id,this[id]);
}
}
}
if (this['class']) node.attributes.set('class',this['class']);
}
for (var i = 0, m = names.length; i < m; i++) {
if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
var value = (this.attr||{})[names[i]];
if (value == null) value = this[names[i]];
if (value === 'true' || value === 'false') value = (value === 'true');
if (value != null) node.attributes.set(names[i],value);
}
},
nodeAddProperties: function (node) {
for (var i = 0, m = PROPERTY.length; i < m; i++) {
var name = PROPERTY[i];
if (this[name] != null &&
(this.defaults[name] == null || this.defaults[name] === MML.AUTO)) {
node.setProperty(RENAME[name] || name, this[name]);
}
}
}
});
MML.chars.Augment({
toMmlNode: function (factory) {
return factory.MML.text().setText(this.data.join(""));
}
});
MML.entity.Augment({
toMmlNode: function (factory) {
return factory.MML.text().setText(this.toString());
}
});
MML.msubsup.Augment({
toMmlNode: function (factory) {
var kind = (this.data[this.sub] == null ? 'msup' :
this.data[this.sup] == null ? 'msub' : 'msubsup');
return this.nodeMake(factory, kind);
}
});
MML.munderover.Augment({
toMmlNode: function (factory) {
var kind = (this.data[this.under] == null ? 'mover' :
this.data[this.over] == null ? 'munder' : 'munderover');
return this.nodeMake(factory, kind);
}
});
MML.xml.Augment({
toMmlNode: function (factory) {
return factory.MML.xml(this.data);
}
});
})();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,122 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/Arrows.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u219A': MO.RELACCENT, // leftwards arrow with stroke
'\u219B': MO.RELACCENT, // rightwards arrow with stroke
'\u219C': MO.WIDEREL, // leftwards wave arrow
'\u219D': MO.WIDEREL, // rightwards wave arrow
'\u219E': MO.WIDEREL, // leftwards two headed arrow
'\u219F': MO.WIDEREL, // upwards two headed arrow
'\u21A0': MO.WIDEREL, // rightwards two headed arrow
'\u21A1': MO.RELSTRETCH, // downwards two headed arrow
'\u21A2': MO.WIDEREL, // leftwards arrow with tail
'\u21A3': MO.WIDEREL, // rightwards arrow with tail
'\u21A4': MO.WIDEREL, // leftwards arrow from bar
'\u21A5': MO.RELSTRETCH, // upwards arrow from bar
'\u21A7': MO.RELSTRETCH, // downwards arrow from bar
'\u21A8': MO.RELSTRETCH, // up down arrow with base
'\u21AB': MO.WIDEREL, // leftwards arrow with loop
'\u21AC': MO.WIDEREL, // rightwards arrow with loop
'\u21AD': MO.WIDEREL, // left right wave arrow
'\u21AE': MO.RELACCENT, // left right arrow with stroke
'\u21AF': MO.RELSTRETCH, // downwards zigzag arrow
'\u21B0': MO.RELSTRETCH, // upwards arrow with tip leftwards
'\u21B1': MO.RELSTRETCH, // upwards arrow with tip rightwards
'\u21B2': MO.RELSTRETCH, // downwards arrow with tip leftwards
'\u21B3': MO.RELSTRETCH, // downwards arrow with tip rightwards
'\u21B4': MO.RELSTRETCH, // rightwards arrow with corner downwards
'\u21B5': MO.RELSTRETCH, // downwards arrow with corner leftwards
'\u21B6': MO.RELACCENT, // anticlockwise top semicircle arrow
'\u21B7': MO.RELACCENT, // clockwise top semicircle arrow
'\u21B8': MO.REL, // north west arrow to long bar
'\u21B9': MO.WIDEREL, // leftwards arrow to bar over rightwards arrow to bar
'\u21BA': MO.REL, // anticlockwise open circle arrow
'\u21BB': MO.REL, // clockwise open circle arrow
'\u21BE': MO.RELSTRETCH, // upwards harpoon with barb rightwards
'\u21BF': MO.RELSTRETCH, // upwards harpoon with barb leftwards
'\u21C2': MO.RELSTRETCH, // downwards harpoon with barb rightwards
'\u21C3': MO.RELSTRETCH, // downwards harpoon with barb leftwards
'\u21C4': MO.WIDEREL, // rightwards arrow over leftwards arrow
'\u21C5': MO.RELSTRETCH, // upwards arrow leftwards of downwards arrow
'\u21C6': MO.WIDEREL, // leftwards arrow over rightwards arrow
'\u21C7': MO.WIDEREL, // leftwards paired arrows
'\u21C8': MO.RELSTRETCH, // upwards paired arrows
'\u21C9': MO.WIDEREL, // rightwards paired arrows
'\u21CA': MO.RELSTRETCH, // downwards paired arrows
'\u21CB': MO.WIDEREL, // leftwards harpoon over rightwards harpoon
'\u21CD': MO.RELACCENT, // leftwards double arrow with stroke
'\u21CE': MO.RELACCENT, // left right double arrow with stroke
'\u21CF': MO.RELACCENT, // rightwards double arrow with stroke
'\u21D6': MO.RELSTRETCH, // north west double arrow
'\u21D7': MO.RELSTRETCH, // north east double arrow
'\u21D8': MO.RELSTRETCH, // south east double arrow
'\u21D9': MO.RELSTRETCH, // south west double arrow
'\u21DA': MO.WIDEREL, // leftwards triple arrow
'\u21DB': MO.WIDEREL, // rightwards triple arrow
'\u21DC': MO.WIDEREL, // leftwards squiggle arrow
'\u21DD': MO.WIDEREL, // rightwards squiggle arrow
'\u21DE': MO.REL, // upwards arrow with double stroke
'\u21DF': MO.REL, // downwards arrow with double stroke
'\u21E0': MO.WIDEREL, // leftwards dashed arrow
'\u21E1': MO.RELSTRETCH, // upwards dashed arrow
'\u21E2': MO.WIDEREL, // rightwards dashed arrow
'\u21E3': MO.RELSTRETCH, // downwards dashed arrow
'\u21E4': MO.WIDEREL, // leftwards arrow to bar
'\u21E5': MO.WIDEREL, // rightwards arrow to bar
'\u21E6': MO.WIDEREL, // leftwards white arrow
'\u21E7': MO.RELSTRETCH, // upwards white arrow
'\u21E8': MO.WIDEREL, // rightwards white arrow
'\u21E9': MO.RELSTRETCH, // downwards white arrow
'\u21EA': MO.RELSTRETCH, // upwards white arrow from bar
'\u21EB': MO.RELSTRETCH, // upwards white arrow on pedestal
'\u21EC': MO.RELSTRETCH, // upwards white arrow on pedestal with horizontal bar
'\u21ED': MO.RELSTRETCH, // upwards white arrow on pedestal with vertical bar
'\u21EE': MO.RELSTRETCH, // upwards white double arrow
'\u21EF': MO.RELSTRETCH, // upwards white double arrow on pedestal
'\u21F0': MO.WIDEREL, // rightwards white arrow from wall
'\u21F1': MO.REL, // north west arrow to corner
'\u21F2': MO.REL, // south east arrow to corner
'\u21F3': MO.RELSTRETCH, // up down white arrow
'\u21F4': MO.RELACCENT, // right arrow with small circle
'\u21F5': MO.RELSTRETCH, // downwards arrow leftwards of upwards arrow
'\u21F6': MO.WIDEREL, // three rightwards arrows
'\u21F7': MO.RELACCENT, // leftwards arrow with vertical stroke
'\u21F8': MO.RELACCENT, // rightwards arrow with vertical stroke
'\u21F9': MO.RELACCENT, // left right arrow with vertical stroke
'\u21FA': MO.RELACCENT, // leftwards arrow with double vertical stroke
'\u21FB': MO.RELACCENT, // rightwards arrow with double vertical stroke
'\u21FC': MO.RELACCENT, // left right arrow with double vertical stroke
'\u21FD': MO.WIDEREL, // leftwards open-headed arrow
'\u21FE': MO.WIDEREL, // rightwards open-headed arrow
'\u21FF': MO.WIDEREL // left right open-headed arrow
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/Arrows.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,65 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/BasicLatin.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'||': [0,0,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: ||
'|||': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: |||
},
postfix: {
'!!': [1,0,TEXCLASS.BIN], // multiple character operator: !!
'\'': MO.ACCENT, // apostrophe
'++': [0,0,TEXCLASS.BIN], // multiple character operator: ++
'--': [0,0,TEXCLASS.BIN], // multiple character operator: --
'..': [0,0,TEXCLASS.BIN], // multiple character operator: ..
'...': MO.ORD, // multiple character operator: ...
'||': [0,0,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: ||
'|||': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: |||
},
infix: {
'!=': MO.BIN4, // multiple character operator: !=
'&&': MO.BIN4, // multiple character operator: &&
'**': [1,1,TEXCLASS.BIN], // multiple character operator: **
'*=': MO.BIN4, // multiple character operator: *=
'+=': MO.BIN4, // multiple character operator: +=
'-=': MO.BIN4, // multiple character operator: -=
'->': MO.BIN5, // multiple character operator: ->
'//': [1,1,TEXCLASS.BIN], // multiple character operator: //
'/=': MO.BIN4, // multiple character operator: /=
':=': MO.BIN4, // multiple character operator: :=
'<=': MO.BIN5, // multiple character operator: <=
'<>': [1,1,TEXCLASS.BIN], // multiple character operator: <>
'==': MO.BIN4, // multiple character operator: ==
'>=': MO.BIN5, // multiple character operator: >=
'@': MO.ORD11, // commercial at
'||': [2,2,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: ||
'|||': [2,2,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: |||
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/BasicLatin.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,35 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/CombDiacritMarks.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
postfix: {
'\u0311': MO.ACCENT // combining inverted breve
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/CombDiacritMarks.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,36 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/CombDiactForSymbols.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
postfix: {
'\u20DB': MO.ACCENT, // combining three dots above
'\u20DC': MO.ACCENT // combining four dots above
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/CombDiactForSymbols.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,38 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/Dingbats.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2772': MO.OPEN // light left tortoise shell bracket ornament
},
postfix: {
'\u2773': MO.CLOSE // light right tortoise shell bracket ornament
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/Dingbats.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,42 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/GeneralPunctuation.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2016': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // double vertical line
'\u2018': [0,0,TEXCLASS.OPEN,{fence: true}], // left single quotation mark
'\u201C': [0,0,TEXCLASS.OPEN,{fence: true}] // left double quotation mark
},
postfix: {
'\u2016': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // double vertical line
'\u2019': [0,0,TEXCLASS.CLOSE,{fence: true}], // right single quotation mark
'\u201D': [0,0,TEXCLASS.CLOSE,{fence: true}] // right double quotation mark
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/GeneralPunctuation.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,66 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/GeometricShapes.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u25A0': MO.BIN3, // black square
'\u25A1': MO.BIN3, // white square
'\u25AA': MO.BIN3, // black small square
'\u25AB': MO.BIN3, // white small square
'\u25AD': MO.BIN3, // white rectangle
'\u25AE': MO.BIN3, // black vertical rectangle
'\u25AF': MO.BIN3, // white vertical rectangle
'\u25B0': MO.BIN3, // black parallelogram
'\u25B1': MO.BIN3, // white parallelogram
'\u25B2': MO.BIN4, // black up-pointing triangle
'\u25B4': MO.BIN4, // black up-pointing small triangle
'\u25B6': MO.BIN4, // black right-pointing triangle
'\u25B7': MO.BIN4, // white right-pointing triangle
'\u25B8': MO.BIN4, // black right-pointing small triangle
'\u25BC': MO.BIN4, // black down-pointing triangle
'\u25BE': MO.BIN4, // black down-pointing small triangle
'\u25C0': MO.BIN4, // black left-pointing triangle
'\u25C1': MO.BIN4, // white left-pointing triangle
'\u25C2': MO.BIN4, // black left-pointing small triangle
'\u25C4': MO.BIN4, // black left-pointing pointer
'\u25C5': MO.BIN4, // white left-pointing pointer
'\u25C6': MO.BIN4, // black diamond
'\u25C7': MO.BIN4, // white diamond
'\u25C8': MO.BIN4, // white diamond containing black small diamond
'\u25C9': MO.BIN4, // fisheye
'\u25CC': MO.BIN4, // dotted circle
'\u25CD': MO.BIN4, // circle with vertical fill
'\u25CE': MO.BIN4, // bullseye
'\u25CF': MO.BIN4, // black circle
'\u25D6': MO.BIN4, // left half black circle
'\u25D7': MO.BIN4, // right half black circle
'\u25E6': MO.BIN4 // white bullet
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/GeometricShapes.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,35 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/GreekAndCoptic.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u03F6': MO.REL // greek reversed lunate epsilon symbol
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/GreekAndCoptic.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,37 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/Latin1Supplement.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
postfix: {
'\u00B0': MO.ORD, // degree sign
'\u00B4': MO.ACCENT, // acute accent
'\u00B8': MO.ACCENT // cedilla
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/Latin1Supplement.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,36 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/LetterlikeSymbols.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2145': MO.ORD21, // double-struck italic capital d
'\u2146': [2,0,TEXCLASS.ORD] // double-struck italic small d
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/LetterlikeSymbols.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,228 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/MathOperators.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2204': MO.ORD21, // there does not exist
'\u221B': MO.ORD11, // cube root
'\u221C': MO.ORD11, // fourth root
'\u2221': MO.ORD, // measured angle
'\u2222': MO.ORD, // spherical angle
'\u222C': MO.INTEGRAL, // double integral
'\u222D': MO.INTEGRAL, // triple integral
'\u222F': MO.INTEGRAL, // surface integral
'\u2230': MO.INTEGRAL, // volume integral
'\u2231': MO.INTEGRAL, // clockwise integral
'\u2232': MO.INTEGRAL, // clockwise contour integral
'\u2233': MO.INTEGRAL // anticlockwise contour integral
},
infix: {
'\u2201': [1,2,TEXCLASS.ORD], // complement
'\u2206': MO.BIN3, // increment
'\u220A': MO.REL, // small element of
'\u220C': MO.REL, // does not contain as member
'\u220D': MO.REL, // small contains as member
'\u220E': MO.BIN3, // end of proof
'\u2214': MO.BIN4, // dot plus
'\u221F': MO.REL, // right angle
'\u2224': MO.REL, // does not divide
'\u2226': MO.REL, // not parallel to
'\u2234': MO.REL, // therefore
'\u2235': MO.REL, // because
'\u2236': MO.REL, // ratio
'\u2237': MO.REL, // proportion
'\u2238': MO.BIN4, // dot minus
'\u2239': MO.REL, // excess
'\u223A': MO.BIN4, // geometric proportion
'\u223B': MO.REL, // homothetic
'\u223D': MO.REL, // reversed tilde
'\u223D\u0331': MO.BIN3, // reversed tilde with underline
'\u223E': MO.REL, // inverted lazy s
'\u223F': MO.BIN3, // sine wave
'\u2241': MO.REL, // not tilde
'\u2242': MO.REL, // minus tilde
'\u2242\u0338': MO.REL, // minus tilde with slash
'\u2244': MO.REL, // not asymptotically equal to
'\u2246': MO.REL, // approximately but not actually equal to
'\u2247': MO.REL, // neither approximately nor actually equal to
'\u2249': MO.REL, // not almost equal to
'\u224A': MO.REL, // almost equal or equal to
'\u224B': MO.REL, // triple tilde
'\u224C': MO.REL, // all equal to
'\u224E': MO.REL, // geometrically equivalent to
'\u224E\u0338': MO.REL, // geometrically equivalent to with slash
'\u224F': MO.REL, // difference between
'\u224F\u0338': MO.REL, // difference between with slash
'\u2251': MO.REL, // geometrically equal to
'\u2252': MO.REL, // approximately equal to or the image of
'\u2253': MO.REL, // image of or approximately equal to
'\u2254': MO.REL, // colon equals
'\u2255': MO.REL, // equals colon
'\u2256': MO.REL, // ring in equal to
'\u2257': MO.REL, // ring equal to
'\u2258': MO.REL, // corresponds to
'\u2259': MO.REL, // estimates
'\u225A': MO.REL, // equiangular to
'\u225C': MO.REL, // delta equal to
'\u225D': MO.REL, // equal to by definition
'\u225E': MO.REL, // measured by
'\u225F': MO.REL, // questioned equal to
'\u2262': MO.REL, // not identical to
'\u2263': MO.REL, // strictly equivalent to
'\u2266': MO.REL, // less-than over equal to
'\u2266\u0338': MO.REL, // less-than over equal to with slash
'\u2267': MO.REL, // greater-than over equal to
'\u2268': MO.REL, // less-than but not equal to
'\u2269': MO.REL, // greater-than but not equal to
'\u226A\u0338': MO.REL, // much less than with slash
'\u226B\u0338': MO.REL, // much greater than with slash
'\u226C': MO.REL, // between
'\u226D': MO.REL, // not equivalent to
'\u226E': MO.REL, // not less-than
'\u226F': MO.REL, // not greater-than
'\u2270': MO.REL, // neither less-than nor equal to
'\u2271': MO.REL, // neither greater-than nor equal to
'\u2272': MO.REL, // less-than or equivalent to
'\u2273': MO.REL, // greater-than or equivalent to
'\u2274': MO.REL, // neither less-than nor equivalent to
'\u2275': MO.REL, // neither greater-than nor equivalent to
'\u2276': MO.REL, // less-than or greater-than
'\u2277': MO.REL, // greater-than or less-than
'\u2278': MO.REL, // neither less-than nor greater-than
'\u2279': MO.REL, // neither greater-than nor less-than
'\u227C': MO.REL, // precedes or equal to
'\u227D': MO.REL, // succeeds or equal to
'\u227E': MO.REL, // precedes or equivalent to
'\u227F': MO.REL, // succeeds or equivalent to
'\u227F\u0338': MO.REL, // succeeds or equivalent to with slash
'\u2280': MO.REL, // does not precede
'\u2281': MO.REL, // does not succeed
'\u2282\u20D2': MO.REL, // subset of with vertical line
'\u2283\u20D2': MO.REL, // superset of with vertical line
'\u2284': MO.REL, // not a subset of
'\u2285': MO.REL, // not a superset of
'\u2288': MO.REL, // neither a subset of nor equal to
'\u2289': MO.REL, // neither a superset of nor equal to
'\u228A': MO.REL, // subset of with not equal to
'\u228B': MO.REL, // superset of with not equal to
'\u228C': MO.BIN4, // multiset
'\u228D': MO.BIN4, // multiset multiplication
'\u228F': MO.REL, // square image of
'\u228F\u0338': MO.REL, // square image of with slash
'\u2290': MO.REL, // square original of
'\u2290\u0338': MO.REL, // square original of with slash
'\u229A': MO.BIN4, // circled ring operator
'\u229B': MO.BIN4, // circled asterisk operator
'\u229C': MO.BIN4, // circled equals
'\u229D': MO.BIN4, // circled dash
'\u229E': MO.BIN4, // squared plus
'\u229F': MO.BIN4, // squared minus
'\u22A0': MO.BIN4, // squared times
'\u22A1': MO.BIN4, // squared dot operator
'\u22A6': MO.REL, // assertion
'\u22A7': MO.REL, // models
'\u22A9': MO.REL, // forces
'\u22AA': MO.REL, // triple vertical bar right turnstile
'\u22AB': MO.REL, // double vertical bar double right turnstile
'\u22AC': MO.REL, // does not prove
'\u22AD': MO.REL, // not true
'\u22AE': MO.REL, // does not force
'\u22AF': MO.REL, // negated double vertical bar double right turnstile
'\u22B0': MO.REL, // precedes under relation
'\u22B1': MO.REL, // succeeds under relation
'\u22B2': MO.REL, // normal subgroup of
'\u22B3': MO.REL, // contains as normal subgroup
'\u22B4': MO.REL, // normal subgroup of or equal to
'\u22B5': MO.REL, // contains as normal subgroup or equal to
'\u22B6': MO.REL, // original of
'\u22B7': MO.REL, // image of
'\u22B8': MO.REL, // multimap
'\u22B9': MO.REL, // hermitian conjugate matrix
'\u22BA': MO.BIN4, // intercalate
'\u22BB': MO.BIN4, // xor
'\u22BC': MO.BIN4, // nand
'\u22BD': MO.BIN4, // nor
'\u22BE': MO.BIN3, // right angle with arc
'\u22BF': MO.BIN3, // right triangle
'\u22C7': MO.BIN4, // division times
'\u22C9': MO.BIN4, // left normal factor semidirect product
'\u22CA': MO.BIN4, // right normal factor semidirect product
'\u22CB': MO.BIN4, // left semidirect product
'\u22CC': MO.BIN4, // right semidirect product
'\u22CD': MO.REL, // reversed tilde equals
'\u22CE': MO.BIN4, // curly logical or
'\u22CF': MO.BIN4, // curly logical and
'\u22D0': MO.REL, // double subset
'\u22D1': MO.REL, // double superset
'\u22D2': MO.BIN4, // double intersection
'\u22D3': MO.BIN4, // double union
'\u22D4': MO.REL, // pitchfork
'\u22D5': MO.REL, // equal and parallel to
'\u22D6': MO.REL, // less-than with dot
'\u22D7': MO.REL, // greater-than with dot
'\u22D8': MO.REL, // very much less-than
'\u22D9': MO.REL, // very much greater-than
'\u22DA': MO.REL, // less-than equal to or greater-than
'\u22DB': MO.REL, // greater-than equal to or less-than
'\u22DC': MO.REL, // equal to or less-than
'\u22DD': MO.REL, // equal to or greater-than
'\u22DE': MO.REL, // equal to or precedes
'\u22DF': MO.REL, // equal to or succeeds
'\u22E0': MO.REL, // does not precede or equal
'\u22E1': MO.REL, // does not succeed or equal
'\u22E2': MO.REL, // not square image of or equal to
'\u22E3': MO.REL, // not square original of or equal to
'\u22E4': MO.REL, // square image of or not equal to
'\u22E5': MO.REL, // square original of or not equal to
'\u22E6': MO.REL, // less-than but not equivalent to
'\u22E7': MO.REL, // greater-than but not equivalent to
'\u22E8': MO.REL, // precedes but not equivalent to
'\u22E9': MO.REL, // succeeds but not equivalent to
'\u22EA': MO.REL, // not normal subgroup of
'\u22EB': MO.REL, // does not contain as normal subgroup
'\u22EC': MO.REL, // not normal subgroup of or equal to
'\u22ED': MO.REL, // does not contain as normal subgroup or equal
'\u22F0': MO.REL, // up right diagonal ellipsis
'\u22F2': MO.REL, // element of with long horizontal stroke
'\u22F3': MO.REL, // element of with vertical bar at end of horizontal stroke
'\u22F4': MO.REL, // small element of with vertical bar at end of horizontal stroke
'\u22F5': MO.REL, // element of with dot above
'\u22F6': MO.REL, // element of with overbar
'\u22F7': MO.REL, // small element of with overbar
'\u22F8': MO.REL, // element of with underbar
'\u22F9': MO.REL, // element of with two horizontal strokes
'\u22FA': MO.REL, // contains with long horizontal stroke
'\u22FB': MO.REL, // contains with vertical bar at end of horizontal stroke
'\u22FC': MO.REL, // small contains with vertical bar at end of horizontal stroke
'\u22FD': MO.REL, // contains with overbar
'\u22FE': MO.REL, // small contains with overbar
'\u22FF': MO.REL // z notation bag membership
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/MathOperators.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,42 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/MiscMathSymbolsA.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u27E6': MO.OPEN, // mathematical left white square bracket
'\u27EA': MO.OPEN, // mathematical left double angle bracket
'\u27EC': MO.OPEN // mathematical left white tortoise shell bracket
},
postfix: {
'\u27E7': MO.CLOSE, // mathematical right white square bracket
'\u27EB': MO.CLOSE, // mathematical right double angle bracket
'\u27ED': MO.CLOSE // mathematical right white tortoise shell bracket
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/MiscMathSymbolsA.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,168 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/MiscMathSymbolsB.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2980': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // triple vertical bar delimiter
'\u2983': MO.OPEN, // left white curly bracket
'\u2985': MO.OPEN, // left white parenthesis
'\u2987': MO.OPEN, // z notation left image bracket
'\u2989': MO.OPEN, // z notation left binding bracket
'\u298B': MO.OPEN, // left square bracket with underbar
'\u298D': MO.OPEN, // left square bracket with tick in top corner
'\u298F': MO.OPEN, // left square bracket with tick in bottom corner
'\u2991': MO.OPEN, // left angle bracket with dot
'\u2993': MO.OPEN, // left arc less-than bracket
'\u2995': MO.OPEN, // double left arc greater-than bracket
'\u2997': MO.OPEN, // left black tortoise shell bracket
'\u29FC': MO.OPEN // left-pointing curved angle bracket
},
postfix: {
'\u2980': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // triple vertical bar delimiter
'\u2984': MO.CLOSE, // right white curly bracket
'\u2986': MO.CLOSE, // right white parenthesis
'\u2988': MO.CLOSE, // z notation right image bracket
'\u298A': MO.CLOSE, // z notation right binding bracket
'\u298C': MO.CLOSE, // right square bracket with underbar
'\u298E': MO.CLOSE, // right square bracket with tick in bottom corner
'\u2990': MO.CLOSE, // right square bracket with tick in top corner
'\u2992': MO.CLOSE, // right angle bracket with dot
'\u2994': MO.CLOSE, // right arc greater-than bracket
'\u2996': MO.CLOSE, // double right arc less-than bracket
'\u2998': MO.CLOSE, // right black tortoise shell bracket
'\u29FD': MO.CLOSE // right-pointing curved angle bracket
},
infix: {
'\u2981': MO.BIN3, // z notation spot
'\u2982': MO.BIN3, // z notation type colon
'\u2999': MO.BIN3, // dotted fence
'\u299A': MO.BIN3, // vertical zigzag line
'\u299B': MO.BIN3, // measured angle opening left
'\u299C': MO.BIN3, // right angle variant with square
'\u299D': MO.BIN3, // measured right angle with dot
'\u299E': MO.BIN3, // angle with s inside
'\u299F': MO.BIN3, // acute angle
'\u29A0': MO.BIN3, // spherical angle opening left
'\u29A1': MO.BIN3, // spherical angle opening up
'\u29A2': MO.BIN3, // turned angle
'\u29A3': MO.BIN3, // reversed angle
'\u29A4': MO.BIN3, // angle with underbar
'\u29A5': MO.BIN3, // reversed angle with underbar
'\u29A6': MO.BIN3, // oblique angle opening up
'\u29A7': MO.BIN3, // oblique angle opening down
'\u29A8': MO.BIN3, // measured angle with open arm ending in arrow pointing up and right
'\u29A9': MO.BIN3, // measured angle with open arm ending in arrow pointing up and left
'\u29AA': MO.BIN3, // measured angle with open arm ending in arrow pointing down and right
'\u29AB': MO.BIN3, // measured angle with open arm ending in arrow pointing down and left
'\u29AC': MO.BIN3, // measured angle with open arm ending in arrow pointing right and up
'\u29AD': MO.BIN3, // measured angle with open arm ending in arrow pointing left and up
'\u29AE': MO.BIN3, // measured angle with open arm ending in arrow pointing right and down
'\u29AF': MO.BIN3, // measured angle with open arm ending in arrow pointing left and down
'\u29B0': MO.BIN3, // reversed empty set
'\u29B1': MO.BIN3, // empty set with overbar
'\u29B2': MO.BIN3, // empty set with small circle above
'\u29B3': MO.BIN3, // empty set with right arrow above
'\u29B4': MO.BIN3, // empty set with left arrow above
'\u29B5': MO.BIN3, // circle with horizontal bar
'\u29B6': MO.BIN4, // circled vertical bar
'\u29B7': MO.BIN4, // circled parallel
'\u29B8': MO.BIN4, // circled reverse solidus
'\u29B9': MO.BIN4, // circled perpendicular
'\u29BA': MO.BIN4, // circle divided by horizontal bar and top half divided by vertical bar
'\u29BB': MO.BIN4, // circle with superimposed x
'\u29BC': MO.BIN4, // circled anticlockwise-rotated division sign
'\u29BD': MO.BIN4, // up arrow through circle
'\u29BE': MO.BIN4, // circled white bullet
'\u29BF': MO.BIN4, // circled bullet
'\u29C0': MO.REL, // circled less-than
'\u29C1': MO.REL, // circled greater-than
'\u29C2': MO.BIN3, // circle with small circle to the right
'\u29C3': MO.BIN3, // circle with two horizontal strokes to the right
'\u29C4': MO.BIN4, // squared rising diagonal slash
'\u29C5': MO.BIN4, // squared falling diagonal slash
'\u29C6': MO.BIN4, // squared asterisk
'\u29C7': MO.BIN4, // squared small circle
'\u29C8': MO.BIN4, // squared square
'\u29C9': MO.BIN3, // two joined squares
'\u29CA': MO.BIN3, // triangle with dot above
'\u29CB': MO.BIN3, // triangle with underbar
'\u29CC': MO.BIN3, // s in triangle
'\u29CD': MO.BIN3, // triangle with serifs at bottom
'\u29CE': MO.REL, // right triangle above left triangle
'\u29CF': MO.REL, // left triangle beside vertical bar
'\u29CF\u0338': MO.REL, // left triangle beside vertical bar with slash
'\u29D0': MO.REL, // vertical bar beside right triangle
'\u29D0\u0338': MO.REL, // vertical bar beside right triangle with slash
'\u29D1': MO.REL, // bowtie with left half black
'\u29D2': MO.REL, // bowtie with right half black
'\u29D3': MO.REL, // black bowtie
'\u29D4': MO.REL, // times with left half black
'\u29D5': MO.REL, // times with right half black
'\u29D6': MO.BIN4, // white hourglass
'\u29D7': MO.BIN4, // black hourglass
'\u29D8': MO.BIN3, // left wiggly fence
'\u29D9': MO.BIN3, // right wiggly fence
'\u29DB': MO.BIN3, // right double wiggly fence
'\u29DC': MO.BIN3, // incomplete infinity
'\u29DD': MO.BIN3, // tie over infinity
'\u29DE': MO.REL, // infinity negated with vertical bar
'\u29DF': MO.BIN3, // double-ended multimap
'\u29E0': MO.BIN3, // square with contoured outline
'\u29E1': MO.REL, // increases as
'\u29E2': MO.BIN4, // shuffle product
'\u29E3': MO.REL, // equals sign and slanted parallel
'\u29E4': MO.REL, // equals sign and slanted parallel with tilde above
'\u29E5': MO.REL, // identical to and slanted parallel
'\u29E6': MO.REL, // gleich stark
'\u29E7': MO.BIN3, // thermodynamic
'\u29E8': MO.BIN3, // down-pointing triangle with left half black
'\u29E9': MO.BIN3, // down-pointing triangle with right half black
'\u29EA': MO.BIN3, // black diamond with down arrow
'\u29EB': MO.BIN3, // black lozenge
'\u29EC': MO.BIN3, // white circle with down arrow
'\u29ED': MO.BIN3, // black circle with down arrow
'\u29EE': MO.BIN3, // error-barred white square
'\u29EF': MO.BIN3, // error-barred black square
'\u29F0': MO.BIN3, // error-barred white diamond
'\u29F1': MO.BIN3, // error-barred black diamond
'\u29F2': MO.BIN3, // error-barred white circle
'\u29F3': MO.BIN3, // error-barred black circle
'\u29F4': MO.REL, // rule-delayed
'\u29F5': MO.BIN4, // reverse solidus operator
'\u29F6': MO.BIN4, // solidus with overbar
'\u29F7': MO.BIN4, // reverse solidus with horizontal stroke
'\u29F8': MO.BIN3, // big solidus
'\u29F9': MO.BIN3, // big reverse solidus
'\u29FA': MO.BIN3, // double plus
'\u29FB': MO.BIN3, // triple plus
'\u29FE': MO.BIN4, // tiny
'\u29FF': MO.BIN4 // miny
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/MiscMathSymbolsB.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,36 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/MiscSymbolsAndArrows.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u2B45': MO.RELSTRETCH, // leftwards quadruple arrow
'\u2B46': MO.RELSTRETCH // rightwards quadruple arrow
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/MiscSymbolsAndArrows.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,40 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/MiscTechnical.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
postfix: {
'\u23B4': MO.WIDEACCENT, // top square bracket
'\u23B5': MO.WIDEACCENT, // bottom square bracket
'\u23DC': MO.WIDEACCENT, // top parenthesis
'\u23DD': MO.WIDEACCENT, // bottom parenthesis
'\u23E0': MO.WIDEACCENT, // top tortoise shell bracket
'\u23E1': MO.WIDEACCENT // bottom tortoise shell bracket
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/MiscTechnical.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,38 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/SpacingModLetters.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
postfix: {
'\u02CD': MO.WIDEACCENT, // modifier letter low macron
'\u02DA': MO.ACCENT, // ring above
'\u02DD': MO.ACCENT, // double acute accent
'\u02F7': MO.WIDEACCENT // modifier letter low tilde
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/SpacingModLetters.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,289 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/SuppMathOperators.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
prefix: {
'\u2A03': MO.OP, // n-ary union operator with dot
'\u2A05': MO.OP, // n-ary square intersection operator
'\u2A07': MO.OP, // two logical and operator
'\u2A08': MO.OP, // two logical or operator
'\u2A09': MO.OP, // n-ary times operator
'\u2A0A': MO.OP, // modulo two sum
'\u2A0B': MO.INTEGRAL2, // summation with integral
'\u2A0C': MO.INTEGRAL, // quadruple integral operator
'\u2A0D': MO.INTEGRAL2, // finite part integral
'\u2A0E': MO.INTEGRAL2, // integral with double stroke
'\u2A0F': MO.INTEGRAL2, // integral average with slash
'\u2A10': MO.OP, // circulation function
'\u2A11': MO.OP, // anticlockwise integration
'\u2A12': MO.OP, // line integration with rectangular path around pole
'\u2A13': MO.OP, // line integration with semicircular path around pole
'\u2A14': MO.OP, // line integration not including the pole
'\u2A15': MO.INTEGRAL2, // integral around a point operator
'\u2A16': MO.INTEGRAL2, // quaternion integral operator
'\u2A17': MO.INTEGRAL2, // integral with leftwards arrow with hook
'\u2A18': MO.INTEGRAL2, // integral with times sign
'\u2A19': MO.INTEGRAL2, // integral with intersection
'\u2A1A': MO.INTEGRAL2, // integral with union
'\u2A1B': MO.INTEGRAL2, // integral with overbar
'\u2A1C': MO.INTEGRAL2, // integral with underbar
'\u2AFC': MO.OP, // large triple vertical bar operator
'\u2AFF': MO.OP // n-ary white vertical bar
},
infix: {
'\u2A1D': MO.BIN3, // join
'\u2A1E': MO.BIN3, // large left triangle operator
'\u2A1F': MO.BIN3, // z notation schema composition
'\u2A20': MO.BIN3, // z notation schema piping
'\u2A21': MO.BIN3, // z notation schema projection
'\u2A22': MO.BIN4, // plus sign with small circle above
'\u2A23': MO.BIN4, // plus sign with circumflex accent above
'\u2A24': MO.BIN4, // plus sign with tilde above
'\u2A25': MO.BIN4, // plus sign with dot below
'\u2A26': MO.BIN4, // plus sign with tilde below
'\u2A27': MO.BIN4, // plus sign with subscript two
'\u2A28': MO.BIN4, // plus sign with black triangle
'\u2A29': MO.BIN4, // minus sign with comma above
'\u2A2A': MO.BIN4, // minus sign with dot below
'\u2A2B': MO.BIN4, // minus sign with falling dots
'\u2A2C': MO.BIN4, // minus sign with rising dots
'\u2A2D': MO.BIN4, // plus sign in left half circle
'\u2A2E': MO.BIN4, // plus sign in right half circle
'\u2A30': MO.BIN4, // multiplication sign with dot above
'\u2A31': MO.BIN4, // multiplication sign with underbar
'\u2A32': MO.BIN4, // semidirect product with bottom closed
'\u2A33': MO.BIN4, // smash product
'\u2A34': MO.BIN4, // multiplication sign in left half circle
'\u2A35': MO.BIN4, // multiplication sign in right half circle
'\u2A36': MO.BIN4, // circled multiplication sign with circumflex accent
'\u2A37': MO.BIN4, // multiplication sign in double circle
'\u2A38': MO.BIN4, // circled division sign
'\u2A39': MO.BIN4, // plus sign in triangle
'\u2A3A': MO.BIN4, // minus sign in triangle
'\u2A3B': MO.BIN4, // multiplication sign in triangle
'\u2A3C': MO.BIN4, // interior product
'\u2A3D': MO.BIN4, // righthand interior product
'\u2A3E': MO.BIN4, // z notation relational composition
'\u2A40': MO.BIN4, // intersection with dot
'\u2A41': MO.BIN4, // union with minus sign
'\u2A42': MO.BIN4, // union with overbar
'\u2A43': MO.BIN4, // intersection with overbar
'\u2A44': MO.BIN4, // intersection with logical and
'\u2A45': MO.BIN4, // union with logical or
'\u2A46': MO.BIN4, // union above intersection
'\u2A47': MO.BIN4, // intersection above union
'\u2A48': MO.BIN4, // union above bar above intersection
'\u2A49': MO.BIN4, // intersection above bar above union
'\u2A4A': MO.BIN4, // union beside and joined with union
'\u2A4B': MO.BIN4, // intersection beside and joined with intersection
'\u2A4C': MO.BIN4, // closed union with serifs
'\u2A4D': MO.BIN4, // closed intersection with serifs
'\u2A4E': MO.BIN4, // double square intersection
'\u2A4F': MO.BIN4, // double square union
'\u2A50': MO.BIN4, // closed union with serifs and smash product
'\u2A51': MO.BIN4, // logical and with dot above
'\u2A52': MO.BIN4, // logical or with dot above
'\u2A53': MO.BIN4, // double logical and
'\u2A54': MO.BIN4, // double logical or
'\u2A55': MO.BIN4, // two intersecting logical and
'\u2A56': MO.BIN4, // two intersecting logical or
'\u2A57': MO.BIN4, // sloping large or
'\u2A58': MO.BIN4, // sloping large and
'\u2A59': MO.REL, // logical or overlapping logical and
'\u2A5A': MO.BIN4, // logical and with middle stem
'\u2A5B': MO.BIN4, // logical or with middle stem
'\u2A5C': MO.BIN4, // logical and with horizontal dash
'\u2A5D': MO.BIN4, // logical or with horizontal dash
'\u2A5E': MO.BIN4, // logical and with double overbar
'\u2A5F': MO.BIN4, // logical and with underbar
'\u2A60': MO.BIN4, // logical and with double underbar
'\u2A61': MO.BIN4, // small vee with underbar
'\u2A62': MO.BIN4, // logical or with double overbar
'\u2A63': MO.BIN4, // logical or with double underbar
'\u2A64': MO.BIN4, // z notation domain antirestriction
'\u2A65': MO.BIN4, // z notation range antirestriction
'\u2A66': MO.REL, // equals sign with dot below
'\u2A67': MO.REL, // identical with dot above
'\u2A68': MO.REL, // triple horizontal bar with double vertical stroke
'\u2A69': MO.REL, // triple horizontal bar with triple vertical stroke
'\u2A6A': MO.REL, // tilde operator with dot above
'\u2A6B': MO.REL, // tilde operator with rising dots
'\u2A6C': MO.REL, // similar minus similar
'\u2A6D': MO.REL, // congruent with dot above
'\u2A6E': MO.REL, // equals with asterisk
'\u2A6F': MO.REL, // almost equal to with circumflex accent
'\u2A70': MO.REL, // approximately equal or equal to
'\u2A71': MO.BIN4, // equals sign above plus sign
'\u2A72': MO.BIN4, // plus sign above equals sign
'\u2A73': MO.REL, // equals sign above tilde operator
'\u2A74': MO.REL, // double colon equal
'\u2A75': MO.REL, // two consecutive equals signs
'\u2A76': MO.REL, // three consecutive equals signs
'\u2A77': MO.REL, // equals sign with two dots above and two dots below
'\u2A78': MO.REL, // equivalent with four dots above
'\u2A79': MO.REL, // less-than with circle inside
'\u2A7A': MO.REL, // greater-than with circle inside
'\u2A7B': MO.REL, // less-than with question mark above
'\u2A7C': MO.REL, // greater-than with question mark above
'\u2A7D': MO.REL, // less-than or slanted equal to
'\u2A7D\u0338': MO.REL, // less-than or slanted equal to with slash
'\u2A7E': MO.REL, // greater-than or slanted equal to
'\u2A7E\u0338': MO.REL, // greater-than or slanted equal to with slash
'\u2A7F': MO.REL, // less-than or slanted equal to with dot inside
'\u2A80': MO.REL, // greater-than or slanted equal to with dot inside
'\u2A81': MO.REL, // less-than or slanted equal to with dot above
'\u2A82': MO.REL, // greater-than or slanted equal to with dot above
'\u2A83': MO.REL, // less-than or slanted equal to with dot above right
'\u2A84': MO.REL, // greater-than or slanted equal to with dot above left
'\u2A85': MO.REL, // less-than or approximate
'\u2A86': MO.REL, // greater-than or approximate
'\u2A87': MO.REL, // less-than and single-line not equal to
'\u2A88': MO.REL, // greater-than and single-line not equal to
'\u2A89': MO.REL, // less-than and not approximate
'\u2A8A': MO.REL, // greater-than and not approximate
'\u2A8B': MO.REL, // less-than above double-line equal above greater-than
'\u2A8C': MO.REL, // greater-than above double-line equal above less-than
'\u2A8D': MO.REL, // less-than above similar or equal
'\u2A8E': MO.REL, // greater-than above similar or equal
'\u2A8F': MO.REL, // less-than above similar above greater-than
'\u2A90': MO.REL, // greater-than above similar above less-than
'\u2A91': MO.REL, // less-than above greater-than above double-line equal
'\u2A92': MO.REL, // greater-than above less-than above double-line equal
'\u2A93': MO.REL, // less-than above slanted equal above greater-than above slanted equal
'\u2A94': MO.REL, // greater-than above slanted equal above less-than above slanted equal
'\u2A95': MO.REL, // slanted equal to or less-than
'\u2A96': MO.REL, // slanted equal to or greater-than
'\u2A97': MO.REL, // slanted equal to or less-than with dot inside
'\u2A98': MO.REL, // slanted equal to or greater-than with dot inside
'\u2A99': MO.REL, // double-line equal to or less-than
'\u2A9A': MO.REL, // double-line equal to or greater-than
'\u2A9B': MO.REL, // double-line slanted equal to or less-than
'\u2A9C': MO.REL, // double-line slanted equal to or greater-than
'\u2A9D': MO.REL, // similar or less-than
'\u2A9E': MO.REL, // similar or greater-than
'\u2A9F': MO.REL, // similar above less-than above equals sign
'\u2AA0': MO.REL, // similar above greater-than above equals sign
'\u2AA1': MO.REL, // double nested less-than
'\u2AA1\u0338': MO.REL, // double nested less-than with slash
'\u2AA2': MO.REL, // double nested greater-than
'\u2AA2\u0338': MO.REL, // double nested greater-than with slash
'\u2AA3': MO.REL, // double nested less-than with underbar
'\u2AA4': MO.REL, // greater-than overlapping less-than
'\u2AA5': MO.REL, // greater-than beside less-than
'\u2AA6': MO.REL, // less-than closed by curve
'\u2AA7': MO.REL, // greater-than closed by curve
'\u2AA8': MO.REL, // less-than closed by curve above slanted equal
'\u2AA9': MO.REL, // greater-than closed by curve above slanted equal
'\u2AAA': MO.REL, // smaller than
'\u2AAB': MO.REL, // larger than
'\u2AAC': MO.REL, // smaller than or equal to
'\u2AAD': MO.REL, // larger than or equal to
'\u2AAE': MO.REL, // equals sign with bumpy above
'\u2AAF\u0338': MO.REL, // precedes above single-line equals sign with slash
'\u2AB0\u0338': MO.REL, // succeeds above single-line equals sign with slash
'\u2AB1': MO.REL, // precedes above single-line not equal to
'\u2AB2': MO.REL, // succeeds above single-line not equal to
'\u2AB3': MO.REL, // precedes above equals sign
'\u2AB4': MO.REL, // succeeds above equals sign
'\u2AB5': MO.REL, // precedes above not equal to
'\u2AB6': MO.REL, // succeeds above not equal to
'\u2AB7': MO.REL, // precedes above almost equal to
'\u2AB8': MO.REL, // succeeds above almost equal to
'\u2AB9': MO.REL, // precedes above not almost equal to
'\u2ABA': MO.REL, // succeeds above not almost equal to
'\u2ABB': MO.REL, // double precedes
'\u2ABC': MO.REL, // double succeeds
'\u2ABD': MO.REL, // subset with dot
'\u2ABE': MO.REL, // superset with dot
'\u2ABF': MO.REL, // subset with plus sign below
'\u2AC0': MO.REL, // superset with plus sign below
'\u2AC1': MO.REL, // subset with multiplication sign below
'\u2AC2': MO.REL, // superset with multiplication sign below
'\u2AC3': MO.REL, // subset of or equal to with dot above
'\u2AC4': MO.REL, // superset of or equal to with dot above
'\u2AC5': MO.REL, // subset of above equals sign
'\u2AC6': MO.REL, // superset of above equals sign
'\u2AC7': MO.REL, // subset of above tilde operator
'\u2AC8': MO.REL, // superset of above tilde operator
'\u2AC9': MO.REL, // subset of above almost equal to
'\u2ACA': MO.REL, // superset of above almost equal to
'\u2ACB': MO.REL, // subset of above not equal to
'\u2ACC': MO.REL, // superset of above not equal to
'\u2ACD': MO.REL, // square left open box operator
'\u2ACE': MO.REL, // square right open box operator
'\u2ACF': MO.REL, // closed subset
'\u2AD0': MO.REL, // closed superset
'\u2AD1': MO.REL, // closed subset or equal to
'\u2AD2': MO.REL, // closed superset or equal to
'\u2AD3': MO.REL, // subset above superset
'\u2AD4': MO.REL, // superset above subset
'\u2AD5': MO.REL, // subset above subset
'\u2AD6': MO.REL, // superset above superset
'\u2AD7': MO.REL, // superset beside subset
'\u2AD8': MO.REL, // superset beside and joined by dash with subset
'\u2AD9': MO.REL, // element of opening downwards
'\u2ADA': MO.REL, // pitchfork with tee top
'\u2ADB': MO.REL, // transversal intersection
'\u2ADC': MO.REL, // forking
'\u2ADD': MO.REL, // nonforking
'\u2ADE': MO.REL, // short left tack
'\u2ADF': MO.REL, // short down tack
'\u2AE0': MO.REL, // short up tack
'\u2AE1': MO.REL, // perpendicular with s
'\u2AE2': MO.REL, // vertical bar triple right turnstile
'\u2AE3': MO.REL, // double vertical bar left turnstile
'\u2AE4': MO.REL, // vertical bar double left turnstile
'\u2AE5': MO.REL, // double vertical bar double left turnstile
'\u2AE6': MO.REL, // long dash from left member of double vertical
'\u2AE7': MO.REL, // short down tack with overbar
'\u2AE8': MO.REL, // short up tack with underbar
'\u2AE9': MO.REL, // short up tack above short down tack
'\u2AEA': MO.REL, // double down tack
'\u2AEB': MO.REL, // double up tack
'\u2AEC': MO.REL, // double stroke not sign
'\u2AED': MO.REL, // reversed double stroke not sign
'\u2AEE': MO.REL, // does not divide with reversed negation slash
'\u2AEF': MO.REL, // vertical line with circle above
'\u2AF0': MO.REL, // vertical line with circle below
'\u2AF1': MO.REL, // down tack with circle below
'\u2AF2': MO.REL, // parallel with horizontal stroke
'\u2AF3': MO.REL, // parallel with tilde operator
'\u2AF4': MO.BIN4, // triple vertical bar binary relation
'\u2AF5': MO.BIN4, // triple vertical bar with horizontal stroke
'\u2AF6': MO.BIN4, // triple colon operator
'\u2AF7': MO.REL, // triple nested less-than
'\u2AF8': MO.REL, // triple nested greater-than
'\u2AF9': MO.REL, // double-line slanted less-than or equal to
'\u2AFA': MO.REL, // double-line slanted greater-than or equal to
'\u2AFB': MO.BIN4, // triple solidus binary relation
'\u2AFD': MO.BIN4, // double solidus operator
'\u2AFE': MO.BIN3 // white vertical bar
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/SuppMathOperators.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,40 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/SupplementalArrowsA.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u27F0': MO.RELSTRETCH, // upwards quadruple arrow
'\u27F1': MO.RELSTRETCH, // downwards quadruple arrow
'\u27FB': MO.WIDEREL, // long leftwards arrow from bar
'\u27FD': MO.WIDEREL, // long leftwards double arrow from bar
'\u27FE': MO.WIDEREL, // long rightwards double arrow from bar
'\u27FF': MO.WIDEREL // long rightwards squiggle arrow
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/SupplementalArrowsA.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,162 @@
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/optable/SupplementalArrowsB.js
*
* Copyright (c) 2010-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function (MML) {
var MO = MML.mo.OPTYPES;
var TEXCLASS = MML.TEXCLASS;
MathJax.Hub.Insert(MML.mo.prototype,{
OPTABLE: {
infix: {
'\u2900': MO.RELACCENT, // rightwards two-headed arrow with vertical stroke
'\u2901': MO.RELACCENT, // rightwards two-headed arrow with double vertical stroke
'\u2902': MO.RELACCENT, // leftwards double arrow with vertical stroke
'\u2903': MO.RELACCENT, // rightwards double arrow with vertical stroke
'\u2904': MO.RELACCENT, // left right double arrow with vertical stroke
'\u2905': MO.RELACCENT, // rightwards two-headed arrow from bar
'\u2906': MO.RELACCENT, // leftwards double arrow from bar
'\u2907': MO.RELACCENT, // rightwards double arrow from bar
'\u2908': MO.REL, // downwards arrow with horizontal stroke
'\u2909': MO.REL, // upwards arrow with horizontal stroke
'\u290A': MO.RELSTRETCH, // upwards triple arrow
'\u290B': MO.RELSTRETCH, // downwards triple arrow
'\u290C': MO.WIDEREL, // leftwards double dash arrow
'\u290D': MO.WIDEREL, // rightwards double dash arrow
'\u290E': MO.WIDEREL, // leftwards triple dash arrow
'\u290F': MO.WIDEREL, // rightwards triple dash arrow
'\u2910': MO.WIDEREL, // rightwards two-headed triple dash arrow
'\u2911': MO.RELACCENT, // rightwards arrow with dotted stem
'\u2912': MO.RELSTRETCH, // upwards arrow to bar
'\u2913': MO.RELSTRETCH, // downwards arrow to bar
'\u2914': MO.RELACCENT, // rightwards arrow with tail with vertical stroke
'\u2915': MO.RELACCENT, // rightwards arrow with tail with double vertical stroke
'\u2916': MO.RELACCENT, // rightwards two-headed arrow with tail
'\u2917': MO.RELACCENT, // rightwards two-headed arrow with tail with vertical stroke
'\u2918': MO.RELACCENT, // rightwards two-headed arrow with tail with double vertical stroke
'\u2919': MO.RELACCENT, // leftwards arrow-tail
'\u291A': MO.RELACCENT, // rightwards arrow-tail
'\u291B': MO.RELACCENT, // leftwards double arrow-tail
'\u291C': MO.RELACCENT, // rightwards double arrow-tail
'\u291D': MO.RELACCENT, // leftwards arrow to black diamond
'\u291E': MO.RELACCENT, // rightwards arrow to black diamond
'\u291F': MO.RELACCENT, // leftwards arrow from bar to black diamond
'\u2920': MO.RELACCENT, // rightwards arrow from bar to black diamond
'\u2921': MO.RELSTRETCH, // north west and south east arrow
'\u2922': MO.RELSTRETCH, // north east and south west arrow
'\u2923': MO.REL, // north west arrow with hook
'\u2924': MO.REL, // north east arrow with hook
'\u2925': MO.REL, // south east arrow with hook
'\u2926': MO.REL, // south west arrow with hook
'\u2927': MO.REL, // north west arrow and north east arrow
'\u2928': MO.REL, // north east arrow and south east arrow
'\u2929': MO.REL, // south east arrow and south west arrow
'\u292A': MO.REL, // south west arrow and north west arrow
'\u292B': MO.REL, // rising diagonal crossing falling diagonal
'\u292C': MO.REL, // falling diagonal crossing rising diagonal
'\u292D': MO.REL, // south east arrow crossing north east arrow
'\u292E': MO.REL, // north east arrow crossing south east arrow
'\u292F': MO.REL, // falling diagonal crossing north east arrow
'\u2930': MO.REL, // rising diagonal crossing south east arrow
'\u2931': MO.REL, // north east arrow crossing north west arrow
'\u2932': MO.REL, // north west arrow crossing north east arrow
'\u2933': MO.RELACCENT, // wave arrow pointing directly right
'\u2934': MO.REL, // arrow pointing rightwards then curving upwards
'\u2935': MO.REL, // arrow pointing rightwards then curving downwards
'\u2936': MO.REL, // arrow pointing downwards then curving leftwards
'\u2937': MO.REL, // arrow pointing downwards then curving rightwards
'\u2938': MO.REL, // right-side arc clockwise arrow
'\u2939': MO.REL, // left-side arc anticlockwise arrow
'\u293A': MO.RELACCENT, // top arc anticlockwise arrow
'\u293B': MO.RELACCENT, // bottom arc anticlockwise arrow
'\u293C': MO.RELACCENT, // top arc clockwise arrow with minus
'\u293D': MO.RELACCENT, // top arc anticlockwise arrow with plus
'\u293E': MO.REL, // lower right semicircular clockwise arrow
'\u293F': MO.REL, // lower left semicircular anticlockwise arrow
'\u2940': MO.REL, // anticlockwise closed circle arrow
'\u2941': MO.REL, // clockwise closed circle arrow
'\u2942': MO.RELACCENT, // rightwards arrow above short leftwards arrow
'\u2943': MO.RELACCENT, // leftwards arrow above short rightwards arrow
'\u2944': MO.RELACCENT, // short rightwards arrow above leftwards arrow
'\u2945': MO.RELACCENT, // rightwards arrow with plus below
'\u2946': MO.RELACCENT, // leftwards arrow with plus below
'\u2947': MO.RELACCENT, // rightwards arrow through x
'\u2948': MO.RELACCENT, // left right arrow through small circle
'\u2949': MO.REL, // upwards two-headed arrow from small circle
'\u294A': MO.RELACCENT, // left barb up right barb down harpoon
'\u294B': MO.RELACCENT, // left barb down right barb up harpoon
'\u294C': MO.REL, // up barb right down barb left harpoon
'\u294D': MO.REL, // up barb left down barb right harpoon
'\u294E': MO.WIDEREL, // left barb up right barb up harpoon
'\u294F': MO.RELSTRETCH, // up barb right down barb right harpoon
'\u2950': MO.WIDEREL, // left barb down right barb down harpoon
'\u2951': MO.RELSTRETCH, // up barb left down barb left harpoon
'\u2952': MO.WIDEREL, // leftwards harpoon with barb up to bar
'\u2953': MO.WIDEREL, // rightwards harpoon with barb up to bar
'\u2954': MO.RELSTRETCH, // upwards harpoon with barb right to bar
'\u2955': MO.RELSTRETCH, // downwards harpoon with barb right to bar
'\u2956': MO.RELSTRETCH, // leftwards harpoon with barb down to bar
'\u2957': MO.RELSTRETCH, // rightwards harpoon with barb down to bar
'\u2958': MO.RELSTRETCH, // upwards harpoon with barb left to bar
'\u2959': MO.RELSTRETCH, // downwards harpoon with barb left to bar
'\u295A': MO.WIDEREL, // leftwards harpoon with barb up from bar
'\u295B': MO.WIDEREL, // rightwards harpoon with barb up from bar
'\u295C': MO.RELSTRETCH, // upwards harpoon with barb right from bar
'\u295D': MO.RELSTRETCH, // downwards harpoon with barb right from bar
'\u295E': MO.WIDEREL, // leftwards harpoon with barb down from bar
'\u295F': MO.WIDEREL, // rightwards harpoon with barb down from bar
'\u2960': MO.RELSTRETCH, // upwards harpoon with barb left from bar
'\u2961': MO.RELSTRETCH, // downwards harpoon with barb left from bar
'\u2962': MO.RELACCENT, // leftwards harpoon with barb up above leftwards harpoon with barb down
'\u2963': MO.REL, // upwards harpoon with barb left beside upwards harpoon with barb right
'\u2964': MO.RELACCENT, // rightwards harpoon with barb up above rightwards harpoon with barb down
'\u2965': MO.REL, // downwards harpoon with barb left beside downwards harpoon with barb right
'\u2966': MO.RELACCENT, // leftwards harpoon with barb up above rightwards harpoon with barb up
'\u2967': MO.RELACCENT, // leftwards harpoon with barb down above rightwards harpoon with barb down
'\u2968': MO.RELACCENT, // rightwards harpoon with barb up above leftwards harpoon with barb up
'\u2969': MO.RELACCENT, // rightwards harpoon with barb down above leftwards harpoon with barb down
'\u296A': MO.RELACCENT, // leftwards harpoon with barb up above long dash
'\u296B': MO.RELACCENT, // leftwards harpoon with barb down below long dash
'\u296C': MO.RELACCENT, // rightwards harpoon with barb up above long dash
'\u296D': MO.RELACCENT, // rightwards harpoon with barb down below long dash
'\u296E': MO.RELSTRETCH, // upwards harpoon with barb left beside downwards harpoon with barb right
'\u296F': MO.RELSTRETCH, // downwards harpoon with barb left beside upwards harpoon with barb right
'\u2970': MO.RELACCENT, // right double arrow with rounded head
'\u2971': MO.RELACCENT, // equals sign above rightwards arrow
'\u2972': MO.RELACCENT, // tilde operator above rightwards arrow
'\u2973': MO.RELACCENT, // leftwards arrow above tilde operator
'\u2974': MO.RELACCENT, // rightwards arrow above tilde operator
'\u2975': MO.RELACCENT, // rightwards arrow above almost equal to
'\u2976': MO.RELACCENT, // less-than above leftwards arrow
'\u2977': MO.RELACCENT, // leftwards arrow through less-than
'\u2978': MO.RELACCENT, // greater-than above rightwards arrow
'\u2979': MO.RELACCENT, // subset above rightwards arrow
'\u297A': MO.RELACCENT, // leftwards arrow through subset
'\u297B': MO.RELACCENT, // superset above leftwards arrow
'\u297C': MO.RELACCENT, // left fish tail
'\u297D': MO.RELACCENT, // right fish tail
'\u297E': MO.REL, // up fish tail
'\u297F': MO.REL // down fish tail
}
}
});
MathJax.Ajax.loadComplete(MML.optableDir+"/SupplementalArrowsB.js");
})(MathJax.ElementJax.mml);
@@ -0,0 +1,46 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/input/AsciiMath/config.js
*
* Initializes the AsciiMath InputJax (the main definition is in
* MathJax/jax/input/AsciiMath/jax.js, which is loaded when needed).
*
* Originally adapted for MathJax by David Lippman.
* Additional work done by Davide P. Cervone.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2012-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
MathJax.InputJax.AsciiMath = MathJax.InputJax({
id: "AsciiMath",
version: "2.7.2",
directory: MathJax.InputJax.directory + "/AsciiMath",
extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath",
config: {
fixphi: true, // switch phi and varphi unicode values
useMathMLspacing: true, // use MathML spacing rather than TeX spacing?
displaystyle: true, // put limits above and below operators
decimalsign: "." // can change to "," but watch out for "(1,2)"
}
});
MathJax.InputJax.AsciiMath.Register("math/asciimath");
MathJax.InputJax.AsciiMath.loadComplete("config.js");
File diff suppressed because it is too large Load Diff
+24
View File
@@ -0,0 +1,24 @@
import { AbstractInputJax } from '../core/InputJax.js';
import { OptionList } from '../util/Options.js';
import { FunctionList } from '../util/FunctionList.js';
import { MathDocument } from '../core/MathDocument.js';
import { MathItem } from '../core/MathItem.js';
import { DOMAdaptor } from '../core/DOMAdaptor.js';
import { MmlFactory } from '../core/MmlTree/MmlFactory.js';
import { FindMathML } from './mathml/FindMathML.js';
import { MathMLCompile } from './mathml/MathMLCompile.js';
export declare class MathML<N, T, D> extends AbstractInputJax<N, T, D> {
static NAME: string;
static OPTIONS: OptionList;
protected findMathML: FindMathML<N, T, D>;
protected mathml: MathMLCompile<N, T, D>;
mmlFilters: FunctionList;
constructor(options?: OptionList);
setAdaptor(adaptor: DOMAdaptor<N, T, D>): void;
setMmlFactory(mmlFactory: MmlFactory): void;
get processStrings(): boolean;
compile(math: MathItem<N, T, D>, document: MathDocument<N, T, D>): any;
protected checkForErrors(doc: D): D;
protected error(message: string): void;
findMath(node: N): import("../core/MathItem.js").ProtoItem<N, T>[];
}
+114
View File
@@ -0,0 +1,114 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MathML = void 0;
var InputJax_js_1 = require("../core/InputJax.js");
var Options_js_1 = require("../util/Options.js");
var FunctionList_js_1 = require("../util/FunctionList.js");
var FindMathML_js_1 = require("./mathml/FindMathML.js");
var MathMLCompile_js_1 = require("./mathml/MathMLCompile.js");
var MathML = (function (_super) {
__extends(MathML, _super);
function MathML(options) {
if (options === void 0) { options = {}; }
var _this = this;
var _a = __read((0, Options_js_1.separateOptions)(options, FindMathML_js_1.FindMathML.OPTIONS, MathMLCompile_js_1.MathMLCompile.OPTIONS), 3), mml = _a[0], find = _a[1], compile = _a[2];
_this = _super.call(this, mml) || this;
_this.findMathML = _this.options['FindMathML'] || new FindMathML_js_1.FindMathML(find);
_this.mathml = _this.options['MathMLCompile'] || new MathMLCompile_js_1.MathMLCompile(compile);
_this.mmlFilters = new FunctionList_js_1.FunctionList();
return _this;
}
MathML.prototype.setAdaptor = function (adaptor) {
_super.prototype.setAdaptor.call(this, adaptor);
this.findMathML.adaptor = adaptor;
this.mathml.adaptor = adaptor;
};
MathML.prototype.setMmlFactory = function (mmlFactory) {
_super.prototype.setMmlFactory.call(this, mmlFactory);
this.mathml.setMmlFactory(mmlFactory);
};
Object.defineProperty(MathML.prototype, "processStrings", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
MathML.prototype.compile = function (math, document) {
var mml = math.start.node;
if (!mml || !math.end.node || this.options['forceReparse'] || this.adaptor.kind(mml) === '#text') {
var mathml = this.executeFilters(this.preFilters, math, document, (math.math || '<math></math>').trim());
var doc = this.checkForErrors(this.adaptor.parse(mathml, 'text/' + this.options['parseAs']));
var body = this.adaptor.body(doc);
if (this.adaptor.childNodes(body).length !== 1) {
this.error('MathML must consist of a single element');
}
mml = this.adaptor.remove(this.adaptor.firstChild(body));
if (this.adaptor.kind(mml).replace(/^[a-z]+:/, '') !== 'math') {
this.error('MathML must be formed by a <math> element, not <' + this.adaptor.kind(mml) + '>');
}
}
mml = this.executeFilters(this.mmlFilters, math, document, mml);
return this.executeFilters(this.postFilters, math, document, this.mathml.compile(mml));
};
MathML.prototype.checkForErrors = function (doc) {
var err = this.adaptor.tags(this.adaptor.body(doc), 'parsererror')[0];
if (err) {
if (this.adaptor.textContent(err) === '') {
this.error('Error processing MathML');
}
this.options['parseError'].call(this, err);
}
return doc;
};
MathML.prototype.error = function (message) {
throw new Error(message);
};
MathML.prototype.findMath = function (node) {
return this.findMathML.findMath(node);
};
MathML.NAME = 'MathML';
MathML.OPTIONS = (0, Options_js_1.defaultOptions)({
parseAs: 'html',
forceReparse: false,
FindMathML: null,
MathMLCompile: null,
parseError: function (node) {
this.error(this.adaptor.textContent(node).replace(/\n.*/g, ''));
}
}, InputJax_js_1.AbstractInputJax.OPTIONS);
return MathML;
}(InputJax_js_1.AbstractInputJax));
exports.MathML = MathML;
//# sourceMappingURL=mathml.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"mathml.js","sourceRoot":"","sources":["../../ts/input/mathml.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,mDAAqD;AACrD,iDAA+E;AAC/E,2DAAqD;AAMrD,wDAAkD;AAClD,8DAAwD;AAUxD;IAAqC,0BAAyB;IAyC5D,gBAAY,OAAwB;QAAxB,wBAAA,EAAA,YAAwB;QA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AAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACtE,IAAI,GAAG,EAAE;YACP,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE;gBACxC,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;aACvC;YACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC5C;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAOS,sBAAK,GAAf,UAAgB,OAAe;QAC7B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAKM,yBAAQ,GAAf,UAAgB,IAAO;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAzIa,WAAI,GAAW,QAAQ,CAAC;IAKxB,cAAO,GAAe,IAAA,2BAAc,EAAC;QACjD,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;QAInB,UAAU,EAAE,UAAU,IAAU;YAC9B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC;KACF,EAAE,8BAAgB,CAAC,OAAO,CAAC,CAAC;IA2H/B,aAAC;CAAA,AAhJD,CAAqC,8BAAgB,GAgJpD;AAhJY,wBAAM"}
+13
View File
@@ -0,0 +1,13 @@
import { AbstractFindMath } from '../../core/FindMath.js';
import { DOMAdaptor } from '../../core/DOMAdaptor.js';
import { OptionList } from '../../util/Options.js';
import { ProtoItem } from '../../core/MathItem.js';
export declare class FindMathML<N, T, D> extends AbstractFindMath<N, T, D> {
static OPTIONS: OptionList;
adaptor: DOMAdaptor<N, T, D>;
findMath(node: N): ProtoItem<N, T>[];
protected findMathNodes(node: N, set: Set<N>): void;
protected findMathPrefixed(node: N, set: Set<N>): void;
protected findMathNS(node: N, set: Set<N>): void;
protected processMath(set: Set<N>): ProtoItem<N, T>[];
}
+137
View File
@@ -0,0 +1,137 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindMathML = void 0;
var FindMath_js_1 = require("../../core/FindMath.js");
var NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
var FindMathML = (function (_super) {
__extends(FindMathML, _super);
function FindMathML() {
return _super !== null && _super.apply(this, arguments) || this;
}
FindMathML.prototype.findMath = function (node) {
var set = new Set();
this.findMathNodes(node, set);
this.findMathPrefixed(node, set);
var html = this.adaptor.root(this.adaptor.document);
if (this.adaptor.kind(html) === 'html' && set.size === 0) {
this.findMathNS(node, set);
}
return this.processMath(set);
};
FindMathML.prototype.findMathNodes = function (node, set) {
var e_1, _a;
try {
for (var _b = __values(this.adaptor.tags(node, 'math')), _c = _b.next(); !_c.done; _c = _b.next()) {
var math = _c.value;
set.add(math);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
FindMathML.prototype.findMathPrefixed = function (node, set) {
var e_2, _a, e_3, _b;
var html = this.adaptor.root(this.adaptor.document);
try {
for (var _c = __values(this.adaptor.allAttributes(html)), _d = _c.next(); !_d.done; _d = _c.next()) {
var attr = _d.value;
if (attr.name.substr(0, 6) === 'xmlns:' && attr.value === NAMESPACE) {
var prefix = attr.name.substr(6);
try {
for (var _e = (e_3 = void 0, __values(this.adaptor.tags(node, prefix + ':math'))), _f = _e.next(); !_f.done; _f = _e.next()) {
var math = _f.value;
set.add(math);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_3) throw e_3.error; }
}
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
};
FindMathML.prototype.findMathNS = function (node, set) {
var e_4, _a;
try {
for (var _b = __values(this.adaptor.tags(node, 'math', NAMESPACE)), _c = _b.next(); !_c.done; _c = _b.next()) {
var math = _c.value;
set.add(math);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
};
FindMathML.prototype.processMath = function (set) {
var e_5, _a;
var math = [];
try {
for (var _b = __values(Array.from(set)), _c = _b.next(); !_c.done; _c = _b.next()) {
var mml = _c.value;
var display = (this.adaptor.getAttribute(mml, 'display') === 'block' ||
this.adaptor.getAttribute(mml, 'mode') === 'display');
var start = { node: mml, n: 0, delim: '' };
var end = { node: mml, n: 0, delim: '' };
math.push({ math: this.adaptor.outerHTML(mml), start: start, end: end, display: display });
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_5) throw e_5.error; }
}
return math;
};
FindMathML.OPTIONS = {};
return FindMathML;
}(FindMath_js_1.AbstractFindMath));
exports.FindMathML = FindMathML;
//# sourceMappingURL=FindMathML.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"FindMathML.js","sourceRoot":"","sources":["../../../ts/input/mathml/FindMathML.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,sDAAwD;AAQxD,IAAM,SAAS,GAAG,oCAAoC,CAAC;AAWvD;IAAyC,8BAAyB;IAAlE;;IAuFA,CAAC;IApEQ,6BAAQ,GAAf,UAAgB,IAAO;QACrB,IAAI,GAAG,GAAG,IAAI,GAAG,EAAK,CAAC;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACjC,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,IAAK,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;YACzD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAQS,kCAAa,GAAvB,UAAwB,IAAO,EAAE,GAAW;;;YAC1C,KAAmB,IAAA,KAAA,SAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA,gBAAA,4BAAE;gBAA/C,IAAM,IAAI,WAAA;gBACb,GAAG,CAAC,GAAG,CAAC,IA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AG,WAAA;gBACZ,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,OAAO;oBACrD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;gBACrE,IAAI,KAAK,GAAG,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;gBACzC,IAAI,GAAG,GAAK,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;gBACzC,IAAI,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,OAAA,EAAE,GAAG,KAAA,EAAE,OAAO,SAAA,EAAC,CAAC,CAAC;aACrE;;;;;;;;;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAhFa,kBAAO,GAAe,EAAE,CAAC;IAkFzC,iBAAC;CAAA,AAvFD,CAAyC,8BAAgB,GAuFxD;AAvFY,gCAAU"}
+24
View File
@@ -0,0 +1,24 @@
import { MmlFactory } from '../../core/MmlTree/MmlFactory.js';
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import { OptionList } from '../../util/Options.js';
import { DOMAdaptor } from '../../core/DOMAdaptor.js';
export declare class MathMLCompile<N, T, D> {
static OPTIONS: OptionList;
adaptor: DOMAdaptor<N, T, D>;
protected factory: MmlFactory;
protected options: OptionList;
constructor(options?: OptionList);
setMmlFactory(mmlFactory: MmlFactory): void;
compile(node: N): MmlNode;
makeNode(node: N): MmlNode;
protected addAttributes(mml: MmlNode, node: N): void;
protected filterAttribute(_name: string, value: string): string;
protected filterClassList(list: string[]): string[];
protected addChildren(mml: MmlNode, node: N): void;
protected addText(mml: MmlNode, child: N): void;
protected checkClass(mml: MmlNode, node: N): void;
protected fixCalligraphic(variant: string): string;
protected markMrows(mml: MmlNode): void;
protected trimSpace(text: string): string;
protected error(message: string): void;
}
+291
View File
@@ -0,0 +1,291 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MathMLCompile = void 0;
var MmlNode_js_1 = require("../../core/MmlTree/MmlNode.js");
var Options_js_1 = require("../../util/Options.js");
var Entities = __importStar(require("../../util/Entities.js"));
var MathMLCompile = (function () {
function MathMLCompile(options) {
if (options === void 0) { options = {}; }
var Class = this.constructor;
this.options = (0, Options_js_1.userOptions)((0, Options_js_1.defaultOptions)({}, Class.OPTIONS), options);
}
MathMLCompile.prototype.setMmlFactory = function (mmlFactory) {
this.factory = mmlFactory;
};
MathMLCompile.prototype.compile = function (node) {
var mml = this.makeNode(node);
mml.verifyTree(this.options['verify']);
mml.setInheritedAttributes({}, false, 0, false);
mml.walkTree(this.markMrows);
return mml;
};
MathMLCompile.prototype.makeNode = function (node) {
var e_1, _a;
var adaptor = this.adaptor;
var limits = false;
var kind = adaptor.kind(node).replace(/^.*:/, '');
var texClass = adaptor.getAttribute(node, 'data-mjx-texclass') || '';
if (texClass) {
texClass = this.filterAttribute('data-mjx-texclass', texClass) || '';
}
var type = texClass && kind === 'mrow' ? 'TeXAtom' : kind;
try {
for (var _b = __values(this.filterClassList(adaptor.allClasses(node))), _c = _b.next(); !_c.done; _c = _b.next()) {
var name_1 = _c.value;
if (name_1.match(/^MJX-TeXAtom-/) && kind === 'mrow') {
texClass = name_1.substr(12);
type = 'TeXAtom';
}
else if (name_1 === 'MJX-fixedlimits') {
limits = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this.factory.getNodeClass(type) || this.error('Unknown node type "' + type + '"');
var mml = this.factory.create(type);
if (type === 'TeXAtom' && texClass === 'OP' && !limits) {
mml.setProperty('movesupsub', true);
mml.attributes.setInherited('movablelimits', true);
}
if (texClass) {
mml.texClass = MmlNode_js_1.TEXCLASS[texClass];
mml.setProperty('texClass', mml.texClass);
}
this.addAttributes(mml, node);
this.checkClass(mml, node);
this.addChildren(mml, node);
return mml;
};
MathMLCompile.prototype.addAttributes = function (mml, node) {
var e_2, _a;
var ignoreVariant = false;
try {
for (var _b = __values(this.adaptor.allAttributes(node)), _c = _b.next(); !_c.done; _c = _b.next()) {
var attr = _c.value;
var name_2 = attr.name;
var value = this.filterAttribute(name_2, attr.value);
if (value === null || name_2 === 'xmlns') {
continue;
}
if (name_2.substr(0, 9) === 'data-mjx-') {
switch (name_2.substr(9)) {
case 'alternate':
mml.setProperty('variantForm', true);
break;
case 'variant':
mml.attributes.set('mathvariant', value);
ignoreVariant = true;
break;
case 'smallmatrix':
mml.setProperty('scriptlevel', 1);
mml.setProperty('useHeight', false);
break;
case 'accent':
mml.setProperty('mathaccent', value === 'true');
break;
case 'auto-op':
mml.setProperty('autoOP', value === 'true');
break;
case 'script-align':
mml.setProperty('scriptalign', value);
break;
}
}
else if (name_2 !== 'class') {
var val = value.toLowerCase();
if (val === 'true' || val === 'false') {
mml.attributes.set(name_2, val === 'true');
}
else if (!ignoreVariant || name_2 !== 'mathvariant') {
mml.attributes.set(name_2, value);
}
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
MathMLCompile.prototype.filterAttribute = function (_name, value) {
return value;
};
MathMLCompile.prototype.filterClassList = function (list) {
return list;
};
MathMLCompile.prototype.addChildren = function (mml, node) {
var e_3, _a;
if (mml.arity === 0) {
return;
}
var adaptor = this.adaptor;
try {
for (var _b = __values(adaptor.childNodes(node)), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
var name_3 = adaptor.kind(child);
if (name_3 === '#comment') {
continue;
}
if (name_3 === '#text') {
this.addText(mml, child);
}
else if (mml.isKind('annotation-xml')) {
mml.appendChild(this.factory.create('XML').setXML(child, adaptor));
}
else {
var childMml = mml.appendChild(this.makeNode(child));
if (childMml.arity === 0 && adaptor.childNodes(child).length) {
if (this.options['fixMisplacedChildren']) {
this.addChildren(mml, child);
}
else {
childMml.mError('There should not be children for ' + childMml.kind + ' nodes', this.options['verify'], true);
}
}
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
};
MathMLCompile.prototype.addText = function (mml, child) {
var text = this.adaptor.value(child);
if ((mml.isToken || mml.getProperty('isChars')) && mml.arity) {
if (mml.isToken) {
text = Entities.translate(text);
text = this.trimSpace(text);
}
mml.appendChild(this.factory.create('text').setText(text));
}
else if (text.match(/\S/)) {
this.error('Unexpected text node "' + text + '"');
}
};
MathMLCompile.prototype.checkClass = function (mml, node) {
var e_4, _a;
var classList = [];
try {
for (var _b = __values(this.filterClassList(this.adaptor.allClasses(node))), _c = _b.next(); !_c.done; _c = _b.next()) {
var name_4 = _c.value;
if (name_4.substr(0, 4) === 'MJX-') {
if (name_4 === 'MJX-variant') {
mml.setProperty('variantForm', true);
}
else if (name_4.substr(0, 11) !== 'MJX-TeXAtom') {
mml.attributes.set('mathvariant', this.fixCalligraphic(name_4.substr(3)));
}
}
else {
classList.push(name_4);
}
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
if (classList.length) {
mml.attributes.set('class', classList.join(' '));
}
};
MathMLCompile.prototype.fixCalligraphic = function (variant) {
return variant.replace(/caligraphic/, 'calligraphic');
};
MathMLCompile.prototype.markMrows = function (mml) {
if (mml.isKind('mrow') && !mml.isInferred && mml.childNodes.length >= 2) {
var first = mml.childNodes[0];
var last = mml.childNodes[mml.childNodes.length - 1];
if (first.isKind('mo') && first.attributes.get('fence') && first.attributes.get('stretchy') &&
last.isKind('mo') && last.attributes.get('fence') && last.attributes.get('stretchy')) {
if (first.childNodes.length) {
mml.setProperty('open', first.getText());
}
if (last.childNodes.length) {
mml.setProperty('close', last.getText());
}
}
}
};
MathMLCompile.prototype.trimSpace = function (text) {
return text.replace(/[\t\n\r]/g, ' ')
.replace(/^ +/, '')
.replace(/ +$/, '')
.replace(/ +/g, ' ');
};
MathMLCompile.prototype.error = function (message) {
throw new Error(message);
};
MathMLCompile.OPTIONS = {
MmlFactory: null,
fixMisplacedChildren: true,
verify: __assign({}, MmlNode_js_1.AbstractMmlNode.verifyDefaults),
translateEntities: true
};
return MathMLCompile;
}());
exports.MathMLCompile = MathMLCompile;
//# sourceMappingURL=MathMLCompile.js.map
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
import { MathDocument } from '../../../core/MathDocument.js';
export declare function createTransform<N, T, D>(): (node: N, doc: MathDocument<N, T, D>) => N;
+39
View File
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransform = void 0;
function createTransform() {
var nodeRequire = eval('require');
var dirname = eval('__dirname');
try {
nodeRequire.resolve('saxon-js');
}
catch (err) {
throw Error('Saxon-js not found. Run the command:\n npm install saxon-js\nand try again.');
}
var Saxon = nodeRequire('saxon-js');
var path = nodeRequire('path');
var fs = nodeRequire('fs');
var xsltFile = path.resolve(dirname, 'mml3.sef.json');
var xslt = JSON.parse(fs.readFileSync(xsltFile));
return function (node, doc) {
var adaptor = doc.adaptor;
var mml = adaptor.outerHTML(node);
if (!mml.match(/ xmlns[=:]/)) {
mml = mml.replace(/<(?:(\w+)(:))?math/, '<$1$2math xmlns$2$1="http://www.w3.org/1998/Math/MathML"');
}
var result;
try {
result = adaptor.firstChild(adaptor.body(adaptor.parse(Saxon.transform({
stylesheetInternal: xslt,
sourceText: mml,
destination: 'serialized'
}).principalResult)));
}
catch (err) {
result = node;
}
return result;
};
}
exports.createTransform = createTransform;
//# sourceMappingURL=mml3-node.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"mml3-node.js","sourceRoot":"","sources":["../../../../ts/input/mathml/mml3/mml3-node.ts"],"names":[],"mappings":";;;AAoCA,SAAgB,eAAe;IAE7B,IAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAEpC,IAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,IAAI;QACF,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;KACjC;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,KAAK,CAAC,iFAAiF,CAAC,CAAC;KAChG;IACD,IAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACtC,IAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,IAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACxD,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,OAAO,UAAC,IAAO,EAAE,GAA0B;QACzC,IAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAIlC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;YAC5B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,0DAA0D,CAAC,CAAC;SACrG;QAID,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;gBACrE,kBAAkB,EAAE,IAAI;gBACxB,UAAU,EAAE,GAAG;gBACf,WAAW,EAAE,YAAY;aAC1B,CAAC,CAAC,eAAe,CAAC,CAAC,CAAM,CAAC;SAC5B;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAvCD,0CAuCC"}
+15
View File
@@ -0,0 +1,15 @@
import { MathItem } from '../../../core/MathItem.js';
import { MathDocument } from '../../../core/MathDocument.js';
import { Handler } from '../../../core/Handler.js';
export declare type FILTERDATA<N, T, D> = {
math: MathItem<N, T, D>;
document: MathDocument<N, T, D>;
data: N;
};
export declare class Mml3<N, T, D> {
static XSLT: string;
protected transform: (node: N, doc: MathDocument<N, T, D>) => N;
constructor(document: MathDocument<N, T, D>);
mmlFilter(args: FILTERDATA<N, T, D>): void;
}
export declare function Mml3Handler<N, T, D>(handler: Handler<N, T, D>): Handler<N, T, D>;
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"mml3.js","sourceRoot":"","sources":["../../../../ts/input/mathml/mml3/mml3.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,+CAA+C;AAgB/C;IAiBE,cAAY,QAA+B;QACzC,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE;YAIxC,IAAI,CAAC,SAAS,GAAG,IAAA,8BAAe,GAAE,CAAC;SACpC;aAAM;YAIL,IAAM,WAAS,GAAG,IAAI,aAAa,EAAE,CAAC;YACtC,IAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAgB,CAAC;YAC5E,WAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,UAAC,IAAO;gBACvB,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;gBACjC,IAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC3D,IAAM,GAAG,GAAG,WAAS,CAAC,mBAAmB,CAAC,GAAkB,CAAa,CAAC;gBAC1E,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACtC,CAAC,CAAC;SACH;IACH,CAAC;IAOM,wBAAS,GAAhB,UAAiB,IAAyB;QACxC,IA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';
import { OptionList } from '../util/Options.js';
import { MathDocument } from '../core/MathDocument.js';
import { MathItem } from '../core/MathItem.js';
import { MmlNode } from '../core/MmlTree/MmlNode.js';
import { MmlFactory } from '../core/MmlTree/MmlFactory.js';
import { FindTeX } from './tex/FindTeX.js';
import TexError from './tex/TexError.js';
import ParseOptions from './tex/ParseOptions.js';
import { ParserConfiguration } from './tex/Configuration.js';
import './tex/base/BaseConfiguration.js';
export declare class TeX<N, T, D> extends AbstractInputJax<N, T, D> {
static NAME: string;
static OPTIONS: OptionList;
protected findTeX: FindTeX<N, T, D>;
protected configuration: ParserConfiguration;
protected latex: string;
protected mathNode: MmlNode;
private _parseOptions;
protected static configure(packages: (string | [string, number])[]): ParserConfiguration;
protected static tags(options: ParseOptions, configuration: ParserConfiguration): void;
constructor(options?: OptionList);
setMmlFactory(mmlFactory: MmlFactory): void;
get parseOptions(): ParseOptions;
reset(tag?: number): void;
compile(math: MathItem<N, T, D>, document: MathDocument<N, T, D>): MmlNode;
findMath(strings: string[]): import("../core/MathItem.js").ProtoItem<N, T>[];
formatError(err: TexError): MmlNode;
}
+154
View File
@@ -0,0 +1,154 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TeX = void 0;
var InputJax_js_1 = require("../core/InputJax.js");
var Options_js_1 = require("../util/Options.js");
var FindTeX_js_1 = require("./tex/FindTeX.js");
var FilterUtil_js_1 = __importDefault(require("./tex/FilterUtil.js"));
var NodeUtil_js_1 = __importDefault(require("./tex/NodeUtil.js"));
var TexParser_js_1 = __importDefault(require("./tex/TexParser.js"));
var TexError_js_1 = __importDefault(require("./tex/TexError.js"));
var ParseOptions_js_1 = __importDefault(require("./tex/ParseOptions.js"));
var Tags_js_1 = require("./tex/Tags.js");
var Configuration_js_1 = require("./tex/Configuration.js");
require("./tex/base/BaseConfiguration.js");
var TeX = (function (_super) {
__extends(TeX, _super);
function TeX(options) {
if (options === void 0) { options = {}; }
var _this = this;
var _a = __read((0, Options_js_1.separateOptions)(options, TeX.OPTIONS, FindTeX_js_1.FindTeX.OPTIONS), 3), rest = _a[0], tex = _a[1], find = _a[2];
_this = _super.call(this, tex) || this;
_this.findTeX = _this.options['FindTeX'] || new FindTeX_js_1.FindTeX(find);
var packages = _this.options.packages;
var configuration = _this.configuration = TeX.configure(packages);
var parseOptions = _this._parseOptions =
new ParseOptions_js_1.default(configuration, [_this.options, Tags_js_1.TagsFactory.OPTIONS]);
(0, Options_js_1.userOptions)(parseOptions.options, rest);
configuration.config(_this);
TeX.tags(parseOptions, configuration);
_this.postFilters.add(FilterUtil_js_1.default.cleanSubSup, -6);
_this.postFilters.add(FilterUtil_js_1.default.setInherited, -5);
_this.postFilters.add(FilterUtil_js_1.default.moveLimits, -4);
_this.postFilters.add(FilterUtil_js_1.default.cleanStretchy, -3);
_this.postFilters.add(FilterUtil_js_1.default.cleanAttributes, -2);
_this.postFilters.add(FilterUtil_js_1.default.combineRelations, -1);
return _this;
}
TeX.configure = function (packages) {
var configuration = new Configuration_js_1.ParserConfiguration(packages, ['tex']);
configuration.init();
return configuration;
};
TeX.tags = function (options, configuration) {
Tags_js_1.TagsFactory.addTags(configuration.tags);
Tags_js_1.TagsFactory.setDefault(options.options.tags);
options.tags = Tags_js_1.TagsFactory.getDefault();
options.tags.configuration = options;
};
TeX.prototype.setMmlFactory = function (mmlFactory) {
_super.prototype.setMmlFactory.call(this, mmlFactory);
this._parseOptions.nodeFactory.setMmlFactory(mmlFactory);
};
Object.defineProperty(TeX.prototype, "parseOptions", {
get: function () {
return this._parseOptions;
},
enumerable: false,
configurable: true
});
TeX.prototype.reset = function (tag) {
if (tag === void 0) { tag = 0; }
this.parseOptions.tags.reset(tag);
};
TeX.prototype.compile = function (math, document) {
this.parseOptions.clear();
this.executeFilters(this.preFilters, math, document, this.parseOptions);
var display = math.display;
this.latex = math.math;
var node;
this.parseOptions.tags.startEquation(math);
var globalEnv;
try {
var parser = new TexParser_js_1.default(this.latex, { display: display, isInner: false }, this.parseOptions);
node = parser.mml();
globalEnv = parser.stack.global;
}
catch (err) {
if (!(err instanceof TexError_js_1.default)) {
throw err;
}
this.parseOptions.error = true;
node = this.options.formatError(this, err);
}
node = this.parseOptions.nodeFactory.create('node', 'math', [node]);
if (globalEnv === null || globalEnv === void 0 ? void 0 : globalEnv.indentalign) {
NodeUtil_js_1.default.setAttribute(node, 'indentalign', globalEnv.indentalign);
}
if (display) {
NodeUtil_js_1.default.setAttribute(node, 'display', 'block');
}
this.parseOptions.tags.finishEquation(math);
this.parseOptions.root = node;
this.executeFilters(this.postFilters, math, document, this.parseOptions);
this.mathNode = this.parseOptions.root;
return this.mathNode;
};
TeX.prototype.findMath = function (strings) {
return this.findTeX.findMath(strings);
};
TeX.prototype.formatError = function (err) {
var message = err.message.replace(/\n.*/, '');
return this.parseOptions.nodeFactory.create('error', message, err.id, this.latex);
};
TeX.NAME = 'TeX';
TeX.OPTIONS = __assign(__assign({}, InputJax_js_1.AbstractInputJax.OPTIONS), { FindTeX: null, packages: ['base'], digits: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/, maxBuffer: 5 * 1024, formatError: function (jax, err) { return jax.formatError(err); } });
return TeX;
}(InputJax_js_1.AbstractInputJax));
exports.TeX = TeX;
//# sourceMappingURL=tex.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tex.js","sourceRoot":"","sources":["../../ts/input/tex.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,mDAAqD;AACrD,iDAA4E;AAM5E,+CAAyC;AAEzC,sEAA6C;AAC7C,kEAAyC;AACzC,oEAA2C;AAC3C,kEAAyC;AACzC,0EAAiD;AACjD,yCAA0C;AAC1C,2DAA2D;AAE3D,2CAAyC;AAazC;IAAkC,uBAAyB;IA6EzD,aAAY,OAAwB;QAAxB,wBAAA,EAAA,YAAwB;QAApC,iBAiBC;QAhBO,IAAA,KAAA,OAAoB,IAAA,4BAAe,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,oBAAO,CAAC,OAAO,CAAC,IAAA,EAAzE,IAAI,QAAA,EAAE,GAAG,QAAA,EAAE,IAAI,QAA0D,CAAC;gBACjF,kBAAM,GAAG,CAAC;QACV,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,IAAI,oBAAO,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAM,QAAQ,GAAG,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACvC,IAAM,aAAa,GAAG,KAAI,CAAC,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAA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M,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,MAAM,CACzC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IA1Ka,QAAI,GAAW,KAAK,CAAC;IAMrB,WAAO,yBAChB,8BAAgB,CAAC,OAAO,KAC3B,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,CAAC,MAAM,CAAC,EAElB,MAAM,EAAE,qDAAqD,EAE7D,SAAS,EAAE,CAAC,GAAG,IAAI,EACnB,WAAW,EAAE,UAAC,GAAuB,EAAE,GAAa,IAAK,OAAA,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAApB,CAAoB,IAC7E;IA6JJ,UAAC;CAAA,AAlLD,CAAkC,8BAAgB,GAkLjD;AAlLY,kBAAG"}
+34
View File
@@ -0,0 +1,34 @@
import './base/BaseConfiguration.js';
import './action/ActionConfiguration.js';
import './ams/AmsConfiguration.js';
import './amscd/AmsCdConfiguration.js';
import './bbox/BboxConfiguration.js';
import './boldsymbol/BoldsymbolConfiguration.js';
import './braket/BraketConfiguration.js';
import './bussproofs/BussproofsConfiguration.js';
import './cancel/CancelConfiguration.js';
import './cases/CasesConfiguration.js';
import './centernot/CenternotConfiguration.js';
import './color/ColorConfiguration.js';
import './colorv2/ColorV2Configuration.js';
import './colortbl/ColortblConfiguration.js';
import './configmacros/ConfigMacrosConfiguration.js';
import './empheq/EmpheqConfiguration.js';
import './enclose/EncloseConfiguration.js';
import './extpfeil/ExtpfeilConfiguration.js';
import './gensymb/GensymbConfiguration.js';
import './html/HtmlConfiguration.js';
import './mathtools/MathtoolsConfiguration.js';
import './mhchem/MhchemConfiguration.js';
import './newcommand/NewcommandConfiguration.js';
import './noerrors/NoErrorsConfiguration.js';
import './noundefined/NoUndefinedConfiguration.js';
import './physics/PhysicsConfiguration.js';
import './setoptions/SetOptionsConfiguration.js';
import './tagformat/TagFormatConfiguration.js';
import './textcomp/TextcompConfiguration.js';
import './textmacros/TextMacrosConfiguration.js';
import './upgreek/UpgreekConfiguration.js';
import './unicode/UnicodeConfiguration.js';
import './verb/VerbConfiguration.js';
export declare const AllPackages: string[];
+72
View File
@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AllPackages = void 0;
require("./base/BaseConfiguration.js");
require("./action/ActionConfiguration.js");
require("./ams/AmsConfiguration.js");
require("./amscd/AmsCdConfiguration.js");
require("./bbox/BboxConfiguration.js");
require("./boldsymbol/BoldsymbolConfiguration.js");
require("./braket/BraketConfiguration.js");
require("./bussproofs/BussproofsConfiguration.js");
require("./cancel/CancelConfiguration.js");
require("./cases/CasesConfiguration.js");
require("./centernot/CenternotConfiguration.js");
require("./color/ColorConfiguration.js");
require("./colorv2/ColorV2Configuration.js");
require("./colortbl/ColortblConfiguration.js");
require("./configmacros/ConfigMacrosConfiguration.js");
require("./empheq/EmpheqConfiguration.js");
require("./enclose/EncloseConfiguration.js");
require("./extpfeil/ExtpfeilConfiguration.js");
require("./gensymb/GensymbConfiguration.js");
require("./html/HtmlConfiguration.js");
require("./mathtools/MathtoolsConfiguration.js");
require("./mhchem/MhchemConfiguration.js");
require("./newcommand/NewcommandConfiguration.js");
require("./noerrors/NoErrorsConfiguration.js");
require("./noundefined/NoUndefinedConfiguration.js");
require("./physics/PhysicsConfiguration.js");
require("./setoptions/SetOptionsConfiguration.js");
require("./tagformat/TagFormatConfiguration.js");
require("./textcomp/TextcompConfiguration.js");
require("./textmacros/TextMacrosConfiguration.js");
require("./upgreek/UpgreekConfiguration.js");
require("./unicode/UnicodeConfiguration.js");
require("./verb/VerbConfiguration.js");
if (typeof MathJax !== 'undefined' && MathJax.loader) {
MathJax.loader.preLoad('[tex]/action', '[tex]/ams', '[tex]/amscd', '[tex]/bbox', '[tex]/boldsymbol', '[tex]/braket', '[tex]/bussproofs', '[tex]/cancel', '[tex]/cases', '[tex]/centernot', '[tex]/color', '[tex]/colorv2', '[tex]/colortbl', '[tex]/empheq', '[tex]/enclose', '[tex]/extpfeil', '[tex]/gensymb', '[tex]/html', '[tex]/mathtools', '[tex]/mhchem', '[tex]/newcommand', '[tex]/noerrors', '[tex]/noundefined', '[tex]/physics', '[tex]/upgreek', '[tex]/unicode', '[tex]/verb', '[tex]/configmacros', '[tex]/tagformat', '[tex]/textcomp', '[tex]/textmacros', '[tex]/setoptions');
}
exports.AllPackages = [
'base',
'action',
'ams',
'amscd',
'bbox',
'boldsymbol',
'braket',
'bussproofs',
'cancel',
'cases',
'centernot',
'color',
'colortbl',
'empheq',
'enclose',
'extpfeil',
'gensymb',
'html',
'mathtools',
'mhchem',
'newcommand',
'noerrors',
'noundefined',
'upgreek',
'unicode',
'verb',
'configmacros',
'tagformat',
'textcomp',
'textmacros'
];
//# sourceMappingURL=AllPackages.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"AllPackages.js","sourceRoot":"","sources":["../../../ts/input/tex/AllPackages.ts"],"names":[],"mappings":";;;AAuBA,uCAAqC;AACrC,2CAAyC;AACzC,qCAAmC;AACnC,yCAAuC;AACvC,uCAAqC;AACrC,mDAAiD;AACjD,2CAAyC;AACzC,mDAAiD;AACjD,2CAAyC;AACzC,yCAAuC;AACvC,iDAA+C;AAC/C,yCAAuC;AACvC,6CAA2C;AAC3C,+CAA6C;AAC7C,uDAAqD;AACrD,2CAAyC;AACzC,6CAA2C;AAC3C,+CAA6C;AAC7C,6CAA2C;AAC3C,uCAAqC;AACrC,iDAA+C;AAC/C,2CAAyC;AACzC,mDAAiD;AACjD,+CAA6C;AAC7C,qDAAmD;AACnD,6CAA2C;AAC3C,mDAAiD;AACjD,iDAA+C;AAC/C,+CAA6C;AAC7C,mDAAiD;AACjD,6CAA2C;AAC3C,6CAA2C;AAC3C,uCAAqC;AAGrC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE;IACpD,OAAO,CAAC,MAAM,CAAC,OAAO,CACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;CACH;AAEY,QAAA,WAAW,GAAa;IACnC,MAAM;IACN,QAAQ;IACR,KAAK;IACL,OAAO;IACP,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,WAAW;IACX,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,MAAM;IACN,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,aAAa;IACb,SAAS;IACT,SAAS;IACT,MAAM;IACN,cAAc;IACd,WAAW;IACX,UAAU;IACV,YAAY;CACb,CAAC"}
+99
View File
@@ -0,0 +1,99 @@
import { HandlerConfig, FallbackConfig } from './MapHandler.js';
import { StackItemClass } from './StackItem.js';
import { TagsClass } from './Tags.js';
import { OptionList } from '../../util/Options.js';
import { SubHandlers } from './MapHandler.js';
import { FunctionList } from '../../util/FunctionList.js';
import { TeX } from '../tex.js';
import { PrioritizedList } from '../../util/PrioritizedList.js';
export declare type StackItemConfig = {
[kind: string]: StackItemClass;
};
export declare type TagsConfig = {
[kind: string]: TagsClass;
};
export declare type Processor<T> = [T, number];
export declare type ProtoProcessor<T> = Processor<T> | T;
export declare type ProcessorList = Processor<Function>[];
export declare type ConfigMethod = (c: ParserConfiguration, j: TeX<any, any, any>) => void;
export declare type InitMethod = (c: ParserConfiguration) => void;
export declare class Configuration {
readonly name: string;
readonly handler: HandlerConfig;
readonly fallback: FallbackConfig;
readonly items: StackItemConfig;
readonly tags: TagsConfig;
readonly options: OptionList;
readonly nodes: {
[key: string]: any;
};
readonly preprocessors: ProcessorList;
readonly postprocessors: ProcessorList;
readonly initMethod: Processor<InitMethod>;
readonly configMethod: Processor<ConfigMethod>;
priority: number;
readonly parser: string;
private static makeProcessor;
private static _create;
static create(name: string, config?: {
handler?: HandlerConfig;
fallback?: FallbackConfig;
items?: StackItemConfig;
tags?: TagsConfig;
options?: OptionList;
nodes?: {
[key: string]: any;
};
preprocessors?: ProtoProcessor<Function>[];
postprocessors?: ProtoProcessor<Function>[];
init?: ProtoProcessor<InitMethod>;
config?: ProtoProcessor<ConfigMethod>;
priority?: number;
parser?: string;
}): Configuration;
static local(config?: {
handler?: HandlerConfig;
fallback?: FallbackConfig;
items?: StackItemConfig;
tags?: TagsConfig;
options?: OptionList;
nodes?: {
[key: string]: any;
};
preprocessors?: ProtoProcessor<Function>[];
postprocessors?: ProtoProcessor<Function>[];
init?: ProtoProcessor<InitMethod>;
config?: ProtoProcessor<ConfigMethod>;
priority?: number;
parser?: string;
}): Configuration;
private constructor();
get init(): InitMethod;
get config(): ConfigMethod;
}
export declare namespace ConfigurationHandler {
let set: (name: string, map: Configuration) => void;
let get: (name: string) => Configuration;
let keys: () => IterableIterator<string>;
}
export declare class ParserConfiguration {
protected initMethod: FunctionList;
protected configMethod: FunctionList;
protected configurations: PrioritizedList<Configuration>;
protected parsers: string[];
handlers: SubHandlers;
items: StackItemConfig;
tags: TagsConfig;
options: OptionList;
nodes: {
[key: string]: any;
};
constructor(packages: (string | [string, number])[], parsers?: string[]);
init(): void;
config(jax: TeX<any, any, any>): void;
addPackage(pkg: (string | [string, number])): void;
add(name: string, jax: TeX<any, any, any>, options?: OptionList): void;
protected getPackage(name: string): Configuration;
append(config: Configuration, priority?: number): void;
private addFilters;
}
+266
View File
@@ -0,0 +1,266 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserConfiguration = exports.ConfigurationHandler = exports.Configuration = void 0;
var Options_js_1 = require("../../util/Options.js");
var MapHandler_js_1 = require("./MapHandler.js");
var FunctionList_js_1 = require("../../util/FunctionList.js");
var PrioritizedList_js_1 = require("../../util/PrioritizedList.js");
var Tags_js_1 = require("./Tags.js");
var Configuration = (function () {
function Configuration(name, handler, fallback, items, tags, options, nodes, preprocessors, postprocessors, initMethod, configMethod, priority, parser) {
if (handler === void 0) { handler = {}; }
if (fallback === void 0) { fallback = {}; }
if (items === void 0) { items = {}; }
if (tags === void 0) { tags = {}; }
if (options === void 0) { options = {}; }
if (nodes === void 0) { nodes = {}; }
if (preprocessors === void 0) { preprocessors = []; }
if (postprocessors === void 0) { postprocessors = []; }
if (initMethod === void 0) { initMethod = null; }
if (configMethod === void 0) { configMethod = null; }
this.name = name;
this.handler = handler;
this.fallback = fallback;
this.items = items;
this.tags = tags;
this.options = options;
this.nodes = nodes;
this.preprocessors = preprocessors;
this.postprocessors = postprocessors;
this.initMethod = initMethod;
this.configMethod = configMethod;
this.priority = priority;
this.parser = parser;
this.handler = Object.assign({ character: [], delimiter: [], macro: [], environment: [] }, handler);
}
Configuration.makeProcessor = function (func, priority) {
return Array.isArray(func) ? func : [func, priority];
};
Configuration._create = function (name, config) {
var _this = this;
if (config === void 0) { config = {}; }
var priority = config.priority || PrioritizedList_js_1.PrioritizedList.DEFAULTPRIORITY;
var init = config.init ? this.makeProcessor(config.init, priority) : null;
var conf = config.config ? this.makeProcessor(config.config, priority) : null;
var preprocessors = (config.preprocessors || []).map(function (pre) { return _this.makeProcessor(pre, priority); });
var postprocessors = (config.postprocessors || []).map(function (post) { return _this.makeProcessor(post, priority); });
var parser = config.parser || 'tex';
return new Configuration(name, config.handler || {}, config.fallback || {}, config.items || {}, config.tags || {}, config.options || {}, config.nodes || {}, preprocessors, postprocessors, init, conf, priority, parser);
};
Configuration.create = function (name, config) {
if (config === void 0) { config = {}; }
var configuration = Configuration._create(name, config);
ConfigurationHandler.set(name, configuration);
return configuration;
};
Configuration.local = function (config) {
if (config === void 0) { config = {}; }
return Configuration._create('', config);
};
Object.defineProperty(Configuration.prototype, "init", {
get: function () {
return this.initMethod ? this.initMethod[0] : null;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Configuration.prototype, "config", {
get: function () {
return this.configMethod ? this.configMethod[0] : null;
},
enumerable: false,
configurable: true
});
return Configuration;
}());
exports.Configuration = Configuration;
var ConfigurationHandler;
(function (ConfigurationHandler) {
var maps = new Map();
ConfigurationHandler.set = function (name, map) {
maps.set(name, map);
};
ConfigurationHandler.get = function (name) {
return maps.get(name);
};
ConfigurationHandler.keys = function () {
return maps.keys();
};
})(ConfigurationHandler = exports.ConfigurationHandler || (exports.ConfigurationHandler = {}));
var ParserConfiguration = (function () {
function ParserConfiguration(packages, parsers) {
var e_1, _a, e_2, _b;
if (parsers === void 0) { parsers = ['tex']; }
this.initMethod = new FunctionList_js_1.FunctionList();
this.configMethod = new FunctionList_js_1.FunctionList();
this.configurations = new PrioritizedList_js_1.PrioritizedList();
this.parsers = [];
this.handlers = new MapHandler_js_1.SubHandlers();
this.items = {};
this.tags = {};
this.options = {};
this.nodes = {};
this.parsers = parsers;
try {
for (var _c = __values(packages.slice().reverse()), _d = _c.next(); !_d.done; _d = _c.next()) {
var pkg = _d.value;
this.addPackage(pkg);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
try {
for (var _e = __values(this.configurations), _f = _e.next(); !_f.done; _f = _e.next()) {
var _g = _f.value, config = _g.item, priority = _g.priority;
this.append(config, priority);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
}
ParserConfiguration.prototype.init = function () {
this.initMethod.execute(this);
};
ParserConfiguration.prototype.config = function (jax) {
var e_3, _a;
this.configMethod.execute(this, jax);
try {
for (var _b = __values(this.configurations), _c = _b.next(); !_c.done; _c = _b.next()) {
var config = _c.value;
this.addFilters(jax, config.item);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
};
ParserConfiguration.prototype.addPackage = function (pkg) {
var name = typeof pkg === 'string' ? pkg : pkg[0];
var conf = this.getPackage(name);
conf && this.configurations.add(conf, typeof pkg === 'string' ? conf.priority : pkg[1]);
};
ParserConfiguration.prototype.add = function (name, jax, options) {
var e_4, _a;
if (options === void 0) { options = {}; }
var config = this.getPackage(name);
this.append(config);
this.configurations.add(config, config.priority);
this.init();
var parser = jax.parseOptions;
parser.nodeFactory.setCreators(config.nodes);
try {
for (var _b = __values(Object.keys(config.items)), _c = _b.next(); !_c.done; _c = _b.next()) {
var kind = _c.value;
parser.itemFactory.setNodeClass(kind, config.items[kind]);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
Tags_js_1.TagsFactory.addTags(config.tags);
(0, Options_js_1.defaultOptions)(parser.options, config.options);
(0, Options_js_1.userOptions)(parser.options, options);
this.addFilters(jax, config);
if (config.config) {
config.config(this, jax);
}
};
ParserConfiguration.prototype.getPackage = function (name) {
var config = ConfigurationHandler.get(name);
if (config && this.parsers.indexOf(config.parser) < 0) {
throw Error("Package ".concat(name, " doesn't target the proper parser"));
}
return config;
};
ParserConfiguration.prototype.append = function (config, priority) {
priority = priority || config.priority;
if (config.initMethod) {
this.initMethod.add(config.initMethod[0], config.initMethod[1]);
}
if (config.configMethod) {
this.configMethod.add(config.configMethod[0], config.configMethod[1]);
}
this.handlers.add(config.handler, config.fallback, priority);
Object.assign(this.items, config.items);
Object.assign(this.tags, config.tags);
(0, Options_js_1.defaultOptions)(this.options, config.options);
Object.assign(this.nodes, config.nodes);
};
ParserConfiguration.prototype.addFilters = function (jax, config) {
var e_5, _a, e_6, _b;
try {
for (var _c = __values(config.preprocessors), _d = _c.next(); !_d.done; _d = _c.next()) {
var _e = __read(_d.value, 2), pre = _e[0], priority = _e[1];
jax.preFilters.add(pre, priority);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_5) throw e_5.error; }
}
try {
for (var _f = __values(config.postprocessors), _g = _f.next(); !_g.done; _g = _f.next()) {
var _h = __read(_g.value, 2), post = _h[0], priority = _h[1];
jax.postFilters.add(post, priority);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
}
finally { if (e_6) throw e_6.error; }
}
};
return ParserConfiguration;
}());
exports.ParserConfiguration = ParserConfiguration;
//# sourceMappingURL=Configuration.js.map
File diff suppressed because one or more lines are too long
+25
View File
@@ -0,0 +1,25 @@
import ParseOptions from './ParseOptions.js';
declare namespace FilterUtil {
let cleanStretchy: (arg: {
math: any;
data: ParseOptions;
}) => void;
let cleanAttributes: (arg: {
data: ParseOptions;
}) => void;
let combineRelations: (arg: {
data: ParseOptions;
}) => void;
let cleanSubSup: (arg: {
math: any;
data: ParseOptions;
}) => void;
let moveLimits: (arg: {
data: ParseOptions;
}) => void;
let setInherited: (arg: {
math: any;
data: ParseOptions;
}) => void;
}
export default FilterUtil;
+269
View File
@@ -0,0 +1,269 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var MmlNode_js_1 = require("../../core/MmlTree/MmlNode.js");
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var FilterUtil;
(function (FilterUtil) {
FilterUtil.cleanStretchy = function (arg) {
var e_1, _a;
var options = arg.data;
try {
for (var _b = __values(options.getList('fixStretchy')), _c = _b.next(); !_c.done; _c = _b.next()) {
var mo = _c.value;
if (NodeUtil_js_1.default.getProperty(mo, 'fixStretchy')) {
var symbol = NodeUtil_js_1.default.getForm(mo);
if (symbol && symbol[3] && symbol[3]['stretchy']) {
NodeUtil_js_1.default.setAttribute(mo, 'stretchy', false);
}
var parent_1 = mo.parent;
if (!NodeUtil_js_1.default.getTexClass(mo) && (!symbol || !symbol[2])) {
var texAtom = options.nodeFactory.create('node', 'TeXAtom', [mo]);
parent_1.replaceChild(texAtom, mo);
texAtom.inheritAttributesFrom(mo);
}
NodeUtil_js_1.default.removeProperties(mo, 'fixStretchy');
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
FilterUtil.cleanAttributes = function (arg) {
var node = arg.data.root;
node.walkTree(function (mml, _d) {
var e_2, _a;
var attribs = mml.attributes;
if (!attribs) {
return;
}
var keep = new Set((attribs.get('mjx-keep-attrs') || '').split(/ /));
delete (attribs.getAllAttributes())['mjx-keep-attrs'];
try {
for (var _b = __values(attribs.getExplicitNames()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
if (!keep.has(key) && attribs.attributes[key] === mml.attributes.getInherited(key)) {
delete attribs.attributes[key];
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
}, {});
};
FilterUtil.combineRelations = function (arg) {
var e_3, _a, e_4, _b;
var remove = [];
try {
for (var _c = __values(arg.data.getList('mo')), _e = _c.next(); !_e.done; _e = _c.next()) {
var mo = _e.value;
if (mo.getProperty('relationsCombined') || !mo.parent ||
(mo.parent && !NodeUtil_js_1.default.isType(mo.parent, 'mrow')) ||
NodeUtil_js_1.default.getTexClass(mo) !== MmlNode_js_1.TEXCLASS.REL) {
continue;
}
var mml = mo.parent;
var m2 = void 0;
var children = mml.childNodes;
var next = children.indexOf(mo) + 1;
var variantForm = NodeUtil_js_1.default.getProperty(mo, 'variantForm');
while (next < children.length && (m2 = children[next]) &&
NodeUtil_js_1.default.isType(m2, 'mo') &&
NodeUtil_js_1.default.getTexClass(m2) === MmlNode_js_1.TEXCLASS.REL) {
if (variantForm === NodeUtil_js_1.default.getProperty(m2, 'variantForm') &&
_compareExplicit(mo, m2)) {
NodeUtil_js_1.default.appendChildren(mo, NodeUtil_js_1.default.getChildren(m2));
_copyExplicit(['stretchy', 'rspace'], mo, m2);
try {
for (var _f = (e_4 = void 0, __values(m2.getPropertyNames())), _g = _f.next(); !_g.done; _g = _f.next()) {
var name_1 = _g.value;
mo.setProperty(name_1, m2.getProperty(name_1));
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
}
finally { if (e_4) throw e_4.error; }
}
children.splice(next, 1);
remove.push(m2);
m2.parent = null;
m2.setProperty('relationsCombined', true);
}
else {
if (mo.attributes.getExplicit('rspace') == null) {
NodeUtil_js_1.default.setAttribute(mo, 'rspace', '0pt');
}
if (m2.attributes.getExplicit('lspace') == null) {
NodeUtil_js_1.default.setAttribute(m2, 'lspace', '0pt');
}
break;
}
}
mo.attributes.setInherited('form', mo.getForms()[0]);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_e && !_e.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_3) throw e_3.error; }
}
arg.data.removeFromList('mo', remove);
};
var _copyExplicit = function (attrs, node1, node2) {
var attr1 = node1.attributes;
var attr2 = node2.attributes;
attrs.forEach(function (x) {
var attr = attr2.getExplicit(x);
if (attr != null) {
attr1.set(x, attr);
}
});
};
var _compareExplicit = function (node1, node2) {
var e_5, _a;
var filter = function (attr, space) {
var exp = attr.getExplicitNames();
return exp.filter(function (x) {
return x !== space &&
(x !== 'stretchy' ||
attr.getExplicit('stretchy'));
});
};
var attr1 = node1.attributes;
var attr2 = node2.attributes;
var exp1 = filter(attr1, 'lspace');
var exp2 = filter(attr2, 'rspace');
if (exp1.length !== exp2.length) {
return false;
}
try {
for (var exp1_1 = __values(exp1), exp1_1_1 = exp1_1.next(); !exp1_1_1.done; exp1_1_1 = exp1_1.next()) {
var name_2 = exp1_1_1.value;
if (attr1.getExplicit(name_2) !== attr2.getExplicit(name_2)) {
return false;
}
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (exp1_1_1 && !exp1_1_1.done && (_a = exp1_1.return)) _a.call(exp1_1);
}
finally { if (e_5) throw e_5.error; }
}
return true;
};
var _cleanSubSup = function (options, low, up) {
var e_6, _a;
var remove = [];
try {
for (var _b = __values(options.getList('m' + low + up)), _c = _b.next(); !_c.done; _c = _b.next()) {
var mml = _c.value;
var children = mml.childNodes;
if (children[mml[low]] && children[mml[up]]) {
continue;
}
var parent_2 = mml.parent;
var newNode = (children[mml[low]] ?
options.nodeFactory.create('node', 'm' + low, [children[mml.base], children[mml[low]]]) :
options.nodeFactory.create('node', 'm' + up, [children[mml.base], children[mml[up]]]));
NodeUtil_js_1.default.copyAttributes(mml, newNode);
if (parent_2) {
parent_2.replaceChild(newNode, mml);
}
else {
options.root = newNode;
}
remove.push(mml);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_6) throw e_6.error; }
}
options.removeFromList('m' + low + up, remove);
};
FilterUtil.cleanSubSup = function (arg) {
var options = arg.data;
if (options.error) {
return;
}
_cleanSubSup(options, 'sub', 'sup');
_cleanSubSup(options, 'under', 'over');
};
var _moveLimits = function (options, underover, subsup) {
var e_7, _a;
var remove = [];
try {
for (var _b = __values(options.getList(underover)), _c = _b.next(); !_c.done; _c = _b.next()) {
var mml = _c.value;
if (mml.attributes.get('displaystyle')) {
continue;
}
var base = mml.childNodes[mml.base];
var mo = base.coreMO();
if (base.getProperty('movablelimits') && !mo.attributes.getExplicit('movablelimits')) {
var node = options.nodeFactory.create('node', subsup, mml.childNodes);
NodeUtil_js_1.default.copyAttributes(mml, node);
if (mml.parent) {
mml.parent.replaceChild(node, mml);
}
else {
options.root = node;
}
remove.push(mml);
}
}
}
catch (e_7_1) { e_7 = { error: e_7_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_7) throw e_7.error; }
}
options.removeFromList(underover, remove);
};
FilterUtil.moveLimits = function (arg) {
var options = arg.data;
_moveLimits(options, 'munderover', 'msubsup');
_moveLimits(options, 'munder', 'msub');
_moveLimits(options, 'mover', 'msup');
};
FilterUtil.setInherited = function (arg) {
arg.data.root.setInheritedAttributes({}, arg.math['display'], 0, false);
};
})(FilterUtil || (FilterUtil = {}));
exports.default = FilterUtil;
//# sourceMappingURL=FilterUtil.js.map
File diff suppressed because one or more lines are too long
+22
View File
@@ -0,0 +1,22 @@
import { AbstractFindMath } from '../../core/FindMath.js';
import { OptionList } from '../../util/Options.js';
import { ProtoItem } from '../../core/MathItem.js';
export declare type EndItem = [string, boolean, RegExp];
export declare type Delims = [string, string];
export declare class FindTeX<N, T, D> extends AbstractFindMath<N, T, D> {
static OPTIONS: OptionList;
protected start: RegExp;
protected end: {
[name: string]: EndItem;
};
protected hasPatterns: boolean;
protected env: number;
protected sub: number;
constructor(options: OptionList);
protected getPatterns(): void;
protected addPattern(starts: string[], delims: Delims, display: boolean): void;
protected endPattern(end: string, endp?: string): RegExp;
protected findEnd(text: string, n: number, start: RegExpExecArray, end: EndItem): ProtoItem<N, T>;
protected findMathInString(math: ProtoItem<N, T>[], n: number, text: string): void;
findMath(strings: string[]): ProtoItem<N, T>[];
}
+155
View File
@@ -0,0 +1,155 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindTeX = void 0;
var FindMath_js_1 = require("../../core/FindMath.js");
var string_js_1 = require("../../util/string.js");
var MathItem_js_1 = require("../../core/MathItem.js");
var FindTeX = (function (_super) {
__extends(FindTeX, _super);
function FindTeX(options) {
var _this = _super.call(this, options) || this;
_this.getPatterns();
return _this;
}
FindTeX.prototype.getPatterns = function () {
var _this = this;
var options = this.options;
var starts = [], parts = [], subparts = [];
this.end = {};
this.env = this.sub = 0;
var i = 1;
options['inlineMath'].forEach(function (delims) { return _this.addPattern(starts, delims, false); });
options['displayMath'].forEach(function (delims) { return _this.addPattern(starts, delims, true); });
if (starts.length) {
parts.push(starts.sort(string_js_1.sortLength).join('|'));
}
if (options['processEnvironments']) {
parts.push('\\\\begin\\s*\\{([^}]*)\\}');
this.env = i;
i++;
}
if (options['processEscapes']) {
subparts.push('\\\\([\\\\$])');
}
if (options['processRefs']) {
subparts.push('(\\\\(?:eq)?ref\\s*\\{[^}]*\\})');
}
if (subparts.length) {
parts.push('(' + subparts.join('|') + ')');
this.sub = i;
}
this.start = new RegExp(parts.join('|'), 'g');
this.hasPatterns = (parts.length > 0);
};
FindTeX.prototype.addPattern = function (starts, delims, display) {
var _a = __read(delims, 2), open = _a[0], close = _a[1];
starts.push((0, string_js_1.quotePattern)(open));
this.end[open] = [close, display, this.endPattern(close)];
};
FindTeX.prototype.endPattern = function (end, endp) {
return new RegExp((endp || (0, string_js_1.quotePattern)(end)) + '|\\\\(?:[a-zA-Z]|.)|[{}]', 'g');
};
FindTeX.prototype.findEnd = function (text, n, start, end) {
var _a = __read(end, 3), close = _a[0], display = _a[1], pattern = _a[2];
var i = pattern.lastIndex = start.index + start[0].length;
var match, braces = 0;
while ((match = pattern.exec(text))) {
if ((match[1] || match[0]) === close && braces === 0) {
return (0, MathItem_js_1.protoItem)(start[0], text.substr(i, match.index - i), match[0], n, start.index, match.index + match[0].length, display);
}
else if (match[0] === '{') {
braces++;
}
else if (match[0] === '}' && braces) {
braces--;
}
}
return null;
};
FindTeX.prototype.findMathInString = function (math, n, text) {
var start, match;
this.start.lastIndex = 0;
while ((start = this.start.exec(text))) {
if (start[this.env] !== undefined && this.env) {
var end = '\\\\end\\s*(\\{' + (0, string_js_1.quotePattern)(start[this.env]) + '\\})';
match = this.findEnd(text, n, start, ['{' + start[this.env] + '}', true, this.endPattern(null, end)]);
if (match) {
match.math = match.open + match.math + match.close;
match.open = match.close = '';
}
}
else if (start[this.sub] !== undefined && this.sub) {
var math_1 = start[this.sub];
var end = start.index + start[this.sub].length;
if (math_1.length === 2) {
match = (0, MathItem_js_1.protoItem)('', math_1.substr(1), '', n, start.index, end);
}
else {
match = (0, MathItem_js_1.protoItem)('', math_1, '', n, start.index, end, false);
}
}
else {
match = this.findEnd(text, n, start, this.end[start[0]]);
}
if (match) {
math.push(match);
this.start.lastIndex = match.end.n;
}
}
};
FindTeX.prototype.findMath = function (strings) {
var math = [];
if (this.hasPatterns) {
for (var i = 0, m = strings.length; i < m; i++) {
this.findMathInString(math, i, strings[i]);
}
}
return math;
};
FindTeX.OPTIONS = {
inlineMath: [
['\\(', '\\)']
],
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
processEscapes: true,
processEnvironments: true,
processRefs: true,
};
return FindTeX;
}(FindMath_js_1.AbstractFindMath));
exports.FindTeX = FindTeX;
//# sourceMappingURL=FindTeX.js.map
File diff suppressed because one or more lines are too long
+33
View File
@@ -0,0 +1,33 @@
import { SymbolMap } from './SymbolMap.js';
import { ParseInput, ParseResult, ParseMethod } from './Types.js';
export declare type HandlerType = 'delimiter' | 'macro' | 'character' | 'environment';
export declare type HandlerConfig = {
[P in HandlerType]?: string[];
};
export declare type FallbackConfig = {
[P in HandlerType]?: ParseMethod;
};
export declare namespace MapHandler {
let register: (map: SymbolMap) => void;
let getMap: (name: string) => SymbolMap;
}
export declare class SubHandler {
private _configuration;
private _fallback;
add(maps: string[], fallback: ParseMethod, priority?: number): void;
parse(input: ParseInput): ParseResult;
lookup<T>(symbol: string): T;
contains(symbol: string): boolean;
toString(): string;
applicable(symbol: string): SymbolMap;
retrieve(name: string): SymbolMap;
private warn;
}
export declare class SubHandlers {
private map;
add(handlers: HandlerConfig, fallbacks: FallbackConfig, priority?: number): void;
set(name: HandlerType, subHandler: SubHandler): void;
get(name: HandlerType): SubHandler;
retrieve(name: string): SymbolMap;
keys(): IterableIterator<string>;
}
+222
View File
@@ -0,0 +1,222 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubHandlers = exports.SubHandler = exports.MapHandler = void 0;
var PrioritizedList_js_1 = require("../../util/PrioritizedList.js");
var FunctionList_js_1 = require("../../util/FunctionList.js");
var MapHandler;
(function (MapHandler) {
var maps = new Map();
MapHandler.register = function (map) {
maps.set(map.name, map);
};
MapHandler.getMap = function (name) {
return maps.get(name);
};
})(MapHandler = exports.MapHandler || (exports.MapHandler = {}));
var SubHandler = (function () {
function SubHandler() {
this._configuration = new PrioritizedList_js_1.PrioritizedList();
this._fallback = new FunctionList_js_1.FunctionList();
}
SubHandler.prototype.add = function (maps, fallback, priority) {
var e_1, _a;
if (priority === void 0) { priority = PrioritizedList_js_1.PrioritizedList.DEFAULTPRIORITY; }
try {
for (var _b = __values(maps.slice().reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {
var name_1 = _c.value;
var map = MapHandler.getMap(name_1);
if (!map) {
this.warn('Configuration ' + name_1 + ' not found! Omitted.');
return;
}
this._configuration.add(map, priority);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
if (fallback) {
this._fallback.add(fallback, priority);
}
};
SubHandler.prototype.parse = function (input) {
var e_2, _a;
try {
for (var _b = __values(this._configuration), _c = _b.next(); !_c.done; _c = _b.next()) {
var map = _c.value.item;
var result = map.parse(input);
if (result) {
return result;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
var _d = __read(input, 2), env = _d[0], symbol = _d[1];
Array.from(this._fallback)[0].item(env, symbol);
};
SubHandler.prototype.lookup = function (symbol) {
var map = this.applicable(symbol);
return map ? map.lookup(symbol) : null;
};
SubHandler.prototype.contains = function (symbol) {
return this.applicable(symbol) ? true : false;
};
SubHandler.prototype.toString = function () {
var e_3, _a;
var names = [];
try {
for (var _b = __values(this._configuration), _c = _b.next(); !_c.done; _c = _b.next()) {
var map = _c.value.item;
names.push(map.name);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return names.join(', ');
};
SubHandler.prototype.applicable = function (symbol) {
var e_4, _a;
try {
for (var _b = __values(this._configuration), _c = _b.next(); !_c.done; _c = _b.next()) {
var map = _c.value.item;
if (map.contains(symbol)) {
return map;
}
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
return null;
};
SubHandler.prototype.retrieve = function (name) {
var e_5, _a;
try {
for (var _b = __values(this._configuration), _c = _b.next(); !_c.done; _c = _b.next()) {
var map = _c.value.item;
if (map.name === name) {
return map;
}
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_5) throw e_5.error; }
}
return null;
};
SubHandler.prototype.warn = function (message) {
console.log('TexParser Warning: ' + message);
};
return SubHandler;
}());
exports.SubHandler = SubHandler;
var SubHandlers = (function () {
function SubHandlers() {
this.map = new Map();
}
SubHandlers.prototype.add = function (handlers, fallbacks, priority) {
var e_6, _a;
if (priority === void 0) { priority = PrioritizedList_js_1.PrioritizedList.DEFAULTPRIORITY; }
try {
for (var _b = __values(Object.keys(handlers)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
var name_2 = key;
var subHandler = this.get(name_2);
if (!subHandler) {
subHandler = new SubHandler();
this.set(name_2, subHandler);
}
subHandler.add(handlers[name_2], fallbacks[name_2], priority);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_6) throw e_6.error; }
}
};
SubHandlers.prototype.set = function (name, subHandler) {
this.map.set(name, subHandler);
};
SubHandlers.prototype.get = function (name) {
return this.map.get(name);
};
SubHandlers.prototype.retrieve = function (name) {
var e_7, _a;
try {
for (var _b = __values(this.map.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var handler = _c.value;
var map = handler.retrieve(name);
if (map) {
return map;
}
}
}
catch (e_7_1) { e_7 = { error: e_7_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_7) throw e_7.error; }
}
return null;
};
SubHandlers.prototype.keys = function () {
return this.map.keys();
};
return SubHandlers;
}());
exports.SubHandlers = SubHandlers;
//# sourceMappingURL=MapHandler.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"MapHandler.js","sourceRoot":"","sources":["../../../ts/input/tex/MapHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,oEAA8D;AAC9D,8DAAwD;AASxD,IAAiB,UAAU,CAyB1B;AAzBD,WAAiB,UAAU;IAEzB,IAAI,IAAI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,EAAE,UAAU,CAAC,CAAC;IACjC,CAAC;IAQM,yBAAG,GAAV,UAAW,IAAiB;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAQM,8BAAQ,GAAf,UAAgB,IAAY;;;YAC1B,KAAsB,IAAA,KAAA,SAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA,gBAAA,4BAAE;gBAApC,IAAM,OAAO,WAAA;gBAChB,IAAI,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACjC,IAAI,GAAG,EAAE;oBACP,OAAO,GAAG,CAAC;iBACZ;aACF;;;;;;;;;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAOM,0BAAI,GAAX;QACE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAEH,kBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,kCAAW"}
+20
View File
@@ -0,0 +1,20 @@
import { TextNode, MmlNode } from '../../core/MmlTree/MmlNode.js';
import { MmlFactory } from '../../core/MmlTree/MmlFactory.js';
import ParseOptions from './ParseOptions.js';
export declare type NodeFactoryMethod = (factory: NodeFactory, kind: string, ...rest: any[]) => MmlNode;
export declare class NodeFactory {
configuration: ParseOptions;
protected mmlFactory: MmlFactory;
private factory;
static createNode(factory: NodeFactory, kind: string, children?: MmlNode[], def?: any, text?: TextNode): MmlNode;
static createToken(factory: NodeFactory, kind: string, def?: any, text?: string): MmlNode;
static createText(factory: NodeFactory, text: string): TextNode;
static createError(factory: NodeFactory, message: string): MmlNode;
setMmlFactory(mmlFactory: MmlFactory): void;
set(kind: string, func: NodeFactoryMethod): void;
setCreators(maps: {
[kind: string]: NodeFactoryMethod;
}): void;
create(kind: string, ...rest: any[]): MmlNode;
get(kind: string): NodeFactoryMethod;
}
+100
View File
@@ -0,0 +1,100 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeFactory = void 0;
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var NodeFactory = (function () {
function NodeFactory() {
this.mmlFactory = null;
this.factory = { 'node': NodeFactory.createNode,
'token': NodeFactory.createToken,
'text': NodeFactory.createText,
'error': NodeFactory.createError
};
}
NodeFactory.createNode = function (factory, kind, children, def, text) {
if (children === void 0) { children = []; }
if (def === void 0) { def = {}; }
var node = factory.mmlFactory.create(kind);
node.setChildren(children);
if (text) {
node.appendChild(text);
}
NodeUtil_js_1.default.setProperties(node, def);
return node;
};
NodeFactory.createToken = function (factory, kind, def, text) {
if (def === void 0) { def = {}; }
if (text === void 0) { text = ''; }
var textNode = factory.create('text', text);
return factory.create('node', kind, [], def, textNode);
};
NodeFactory.createText = function (factory, text) {
if (text == null) {
return null;
}
return factory.mmlFactory.create('text').setText(text);
};
NodeFactory.createError = function (factory, message) {
var text = factory.create('text', message);
var mtext = factory.create('node', 'mtext', [], {}, text);
var error = factory.create('node', 'merror', [mtext], { 'data-mjx-error': message });
return error;
};
NodeFactory.prototype.setMmlFactory = function (mmlFactory) {
this.mmlFactory = mmlFactory;
};
NodeFactory.prototype.set = function (kind, func) {
this.factory[kind] = func;
};
NodeFactory.prototype.setCreators = function (maps) {
for (var kind in maps) {
this.set(kind, maps[kind]);
}
};
NodeFactory.prototype.create = function (kind) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
var func = this.factory[kind] || this.factory['node'];
var node = func.apply(void 0, __spreadArray([this, rest[0]], __read(rest.slice(1)), false));
if (kind === 'node') {
this.configuration.addNode(rest[0], node);
}
return node;
};
NodeFactory.prototype.get = function (kind) {
return this.factory[kind];
};
return NodeFactory;
}());
exports.NodeFactory = NodeFactory;
//# sourceMappingURL=NodeFactory.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"NodeFactory.js","sourceRoot":"","sources":["../../../ts/input/tex/NodeFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,8DAAqC;AAKrC;IAAA;QAaY,eAAU,GAAe,IAAI,CAAC;QAMhC,YAAO,GACb,EAAC,MAAM,EAAE,WAAW,CAAC,UAAU;YAC9B,OAAO,EAAE,WAAW,CAAC,WAAW;YAChC,MAAM,EAAE,WAAW,CAAC,UAAU;YAC9B,OAAO,EAAE,WAAW,CAAC,WAAW;SAChC,CAAC;IAsHN,CAAC;IA3Ge,sBAAU,GAAxB,UAAyB,OAAoB,EAAE,IAAY,EAClC,QAAwB,EAAE,GAAa,EACvC,IAAe;QADf,yBAAA,EAAA,aAAwB;QAAE,oBAAA,EAAA,QAAa;QAE9D,IAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3B,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SACxB;QACD,qBAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAWa,uBAAW,GAAzB,UAA0B,OAAoB,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G,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC5B;IACH,CAAC;IASM,4BAAM,GAAb,UAAc,IAAY;QAAE,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,6BAAc;;QACxC,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxD,IAAM,IAAI,GAAG,IAAI,8BAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,UAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAC,CAAC;QACnD,IAAI,IAAI,KAAK,MAAM,EAAE;YACnB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAMM,yBAAG,GAAV,UAAW,IAAY;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEH,kBAAC;AAAD,CAAC,AA9ID,IA8IC;AA9IY,kCAAW"}
+28
View File
@@ -0,0 +1,28 @@
import { TextNode, MMLNODE, MmlNode } from '../../core/MmlTree/MmlNode.js';
import { Property, PropertyList } from '../../core/Tree/Node.js';
import { Args } from './Types.js';
import { OperatorDef } from '../../core/MmlTree/OperatorDictionary.js';
declare namespace NodeUtil {
function createEntity(code: string): string;
function getChildren(node: MmlNode): MMLNODE[];
function getText(node: TextNode): string;
function appendChildren(node: MmlNode, children: MMLNODE[]): void;
function setAttribute(node: MmlNode, attribute: string, value: Args): void;
function setProperty(node: MmlNode, property: string, value: Args): void;
function setProperties(node: MmlNode, properties: PropertyList): void;
function getProperty(node: MmlNode, property: string): Property;
function getAttribute(node: MmlNode, attr: string): Property;
function removeProperties(node: MmlNode, ...properties: string[]): void;
function getChildAt(node: MmlNode, position: number): MMLNODE;
function setChild(node: MmlNode, position: number, child: MmlNode): void;
function copyChildren(oldNode: MmlNode, newNode: MmlNode): void;
function copyAttributes(oldNode: MmlNode, newNode: MmlNode): void;
function isType(node: MmlNode, kind: string): boolean;
function isEmbellished(node: MmlNode): boolean;
function getTexClass(node: MmlNode): number;
function getCoreMO(node: MmlNode): MmlNode;
function isNode(item: any): boolean;
function isInferred(node: MmlNode): boolean;
function getForm(node: MmlNode): OperatorDef;
}
export default NodeUtil;
+220
View File
@@ -0,0 +1,220 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var MmlNode_js_1 = require("../../core/MmlTree/MmlNode.js");
var mo_js_1 = require("../../core/MmlTree/MmlNodes/mo.js");
var NodeUtil;
(function (NodeUtil) {
var attrs = new Map([
['autoOP', true],
['fnOP', true],
['movesupsub', true],
['subsupOK', true],
['texprimestyle', true],
['useHeight', true],
['variantForm', true],
['withDelims', true],
['mathaccent', true],
['open', true],
['close', true]
]);
function createEntity(code) {
return String.fromCodePoint(parseInt(code, 16));
}
NodeUtil.createEntity = createEntity;
function getChildren(node) {
return node.childNodes;
}
NodeUtil.getChildren = getChildren;
function getText(node) {
return node.getText();
}
NodeUtil.getText = getText;
function appendChildren(node, children) {
var e_1, _a;
try {
for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
var child = children_1_1.value;
node.appendChild(child);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
}
finally { if (e_1) throw e_1.error; }
}
}
NodeUtil.appendChildren = appendChildren;
function setAttribute(node, attribute, value) {
node.attributes.set(attribute, value);
}
NodeUtil.setAttribute = setAttribute;
function setProperty(node, property, value) {
node.setProperty(property, value);
}
NodeUtil.setProperty = setProperty;
function setProperties(node, properties) {
var e_2, _a;
try {
for (var _b = __values(Object.keys(properties)), _c = _b.next(); !_c.done; _c = _b.next()) {
var name_1 = _c.value;
var value = properties[name_1];
if (name_1 === 'texClass') {
node.texClass = value;
node.setProperty(name_1, value);
}
else if (name_1 === 'movablelimits') {
node.setProperty('movablelimits', value);
if (node.isKind('mo') || node.isKind('mstyle')) {
node.attributes.set('movablelimits', value);
}
}
else if (name_1 === 'inferred') {
}
else if (attrs.has(name_1)) {
node.setProperty(name_1, value);
}
else {
node.attributes.set(name_1, value);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
}
NodeUtil.setProperties = setProperties;
function getProperty(node, property) {
return node.getProperty(property);
}
NodeUtil.getProperty = getProperty;
function getAttribute(node, attr) {
return node.attributes.get(attr);
}
NodeUtil.getAttribute = getAttribute;
function removeProperties(node) {
var properties = [];
for (var _i = 1; _i < arguments.length; _i++) {
properties[_i - 1] = arguments[_i];
}
node.removeProperty.apply(node, __spreadArray([], __read(properties), false));
}
NodeUtil.removeProperties = removeProperties;
function getChildAt(node, position) {
return node.childNodes[position];
}
NodeUtil.getChildAt = getChildAt;
function setChild(node, position, child) {
var children = node.childNodes;
children[position] = child;
if (child) {
child.parent = node;
}
}
NodeUtil.setChild = setChild;
function copyChildren(oldNode, newNode) {
var children = oldNode.childNodes;
for (var i = 0; i < children.length; i++) {
setChild(newNode, i, children[i]);
}
}
NodeUtil.copyChildren = copyChildren;
function copyAttributes(oldNode, newNode) {
newNode.attributes = oldNode.attributes;
setProperties(newNode, oldNode.getAllProperties());
}
NodeUtil.copyAttributes = copyAttributes;
function isType(node, kind) {
return node.isKind(kind);
}
NodeUtil.isType = isType;
function isEmbellished(node) {
return node.isEmbellished;
}
NodeUtil.isEmbellished = isEmbellished;
function getTexClass(node) {
return node.texClass;
}
NodeUtil.getTexClass = getTexClass;
function getCoreMO(node) {
return node.coreMO();
}
NodeUtil.getCoreMO = getCoreMO;
function isNode(item) {
return item instanceof MmlNode_js_1.AbstractMmlNode || item instanceof MmlNode_js_1.AbstractMmlEmptyNode;
}
NodeUtil.isNode = isNode;
function isInferred(node) {
return node.isInferred;
}
NodeUtil.isInferred = isInferred;
function getForm(node) {
var e_3, _a;
if (!isType(node, 'mo')) {
return null;
}
var mo = node;
var forms = mo.getForms();
try {
for (var forms_1 = __values(forms), forms_1_1 = forms_1.next(); !forms_1_1.done; forms_1_1 = forms_1.next()) {
var form = forms_1_1.value;
var symbol = mo_js_1.MmlMo.OPTABLE[form][mo.getText()];
if (symbol) {
return symbol;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (forms_1_1 && !forms_1_1.done && (_a = forms_1.return)) _a.call(forms_1);
}
finally { if (e_3) throw e_3.error; }
}
return null;
}
NodeUtil.getForm = getForm;
})(NodeUtil || (NodeUtil = {}));
exports.default = NodeUtil;
//# sourceMappingURL=NodeUtil.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"NodeUtil.js","sourceRoot":"","sources":["../../../ts/input/tex/NodeUtil.ts"],"names":[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I,MAAM,GAAG,aAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC/C,IAAI,MAAM,EAAE;oBACV,OAAO,MAAM,CAAC;iBACf;aACF;;;;;;;;;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAbe,gBAAO,UAatB,CAAA;AAEH,CAAC,EAhRS,QAAQ,KAAR,QAAQ,QAgRjB;AAED,kBAAe,QAAQ,CAAC"}
+13
View File
@@ -0,0 +1,13 @@
import { Symbol } from './Symbol.js';
import TexParser from './TexParser.js';
declare namespace ParseMethods {
function variable(parser: TexParser, c: string): void;
function digit(parser: TexParser, c: string): void;
function controlSequence(parser: TexParser, _c: string): void;
function mathchar0mi(parser: TexParser, mchar: Symbol): void;
function mathchar0mo(parser: TexParser, mchar: Symbol): void;
function mathchar7(parser: TexParser, mchar: Symbol): void;
function delimiter(parser: TexParser, delim: Symbol): void;
function environment(parser: TexParser, env: string, func: Function, args: any[]): void;
}
export default ParseMethods;
+110
View File
@@ -0,0 +1,110 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var TexConstants_js_1 = require("./TexConstants.js");
var ParseUtil_js_1 = __importDefault(require("./ParseUtil.js"));
var ParseMethods;
(function (ParseMethods) {
function variable(parser, c) {
var def = ParseUtil_js_1.default.getFontDef(parser);
var env = parser.stack.env;
if (env.multiLetterIdentifiers && env.font !== '') {
c = parser.string.substr(parser.i - 1).match(env.multiLetterIdentifiers)[0];
parser.i += c.length - 1;
if (def.mathvariant === TexConstants_js_1.TexConstant.Variant.NORMAL && env.noAutoOP && c.length > 1) {
def.autoOP = false;
}
}
var node = parser.create('token', 'mi', def, c);
parser.Push(node);
}
ParseMethods.variable = variable;
function digit(parser, c) {
var mml;
var pattern = parser.configuration.options['digits'];
var n = parser.string.slice(parser.i - 1).match(pattern);
var def = ParseUtil_js_1.default.getFontDef(parser);
if (n) {
mml = parser.create('token', 'mn', def, n[0].replace(/[{}]/g, ''));
parser.i += n[0].length - 1;
}
else {
mml = parser.create('token', 'mo', def, c);
}
parser.Push(mml);
}
ParseMethods.digit = digit;
function controlSequence(parser, _c) {
var name = parser.GetCS();
parser.parse('macro', [parser, name]);
}
ParseMethods.controlSequence = controlSequence;
function mathchar0mi(parser, mchar) {
var def = mchar.attributes || { mathvariant: TexConstants_js_1.TexConstant.Variant.ITALIC };
var node = parser.create('token', 'mi', def, mchar.char);
parser.Push(node);
}
ParseMethods.mathchar0mi = mathchar0mi;
function mathchar0mo(parser, mchar) {
var def = mchar.attributes || {};
def['stretchy'] = false;
var node = parser.create('token', 'mo', def, mchar.char);
NodeUtil_js_1.default.setProperty(node, 'fixStretchy', true);
parser.configuration.addNode('fixStretchy', node);
parser.Push(node);
}
ParseMethods.mathchar0mo = mathchar0mo;
function mathchar7(parser, mchar) {
var def = mchar.attributes || { mathvariant: TexConstants_js_1.TexConstant.Variant.NORMAL };
if (parser.stack.env['font']) {
def['mathvariant'] = parser.stack.env['font'];
}
var node = parser.create('token', 'mi', def, mchar.char);
parser.Push(node);
}
ParseMethods.mathchar7 = mathchar7;
function delimiter(parser, delim) {
var def = delim.attributes || {};
def = Object.assign({ fence: false, stretchy: false }, def);
var node = parser.create('token', 'mo', def, delim.char);
parser.Push(node);
}
ParseMethods.delimiter = delimiter;
function environment(parser, env, func, args) {
var end = args[0];
var mml = parser.itemFactory.create('begin').setProperties({ name: env, end: end });
mml = func.apply(void 0, __spreadArray([parser, mml], __read(args.slice(1)), false));
parser.Push(mml);
}
ParseMethods.environment = environment;
})(ParseMethods || (ParseMethods = {}));
exports.default = ParseMethods;
//# sourceMappingURL=ParseMethods.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ParseMethods.js","sourceRoot":"","sources":["../../../ts/input/tex/ParseMethods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,8DAAqC;AACrC,qDAA8C;AAE9C,gEAAuC;AAGvC,IAAU,YAAY,CAkIrB;AAlID,WAAU,YAAY;IAOpB,SAAgB,QAAQ,CAAC,MAAiB,EAAE,CAAS;QAEnD,IAAM,GAAG,GAAG,sBAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzC,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QAC7B,IAAI,GAAG,CAAC,sBAAsB,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE;YACjD,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7F,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;YACzB,IAAI,GAAG,CAAC,WAAW,KAAK,6BAAW,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClF,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC;aACpB;SACF;QAED,IAAM,IAAI,GAA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AE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IATe,sBAAS,YASxB,CAAA;IAOD,SAAgB,SAAS,CAAC,MAAiB,EAAE,KAAa;QACxD,IAAI,GAAG,GAAG,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC;QAEjC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,IAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IANe,sBAAS,YAMxB,CAAA;IAUD,SAAgB,WAAW,CAAC,MAAiB,EAAE,GAAW,EAAE,IAAc,EAAE,IAAW;QACrF,IAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAC,CAAC,CAAC;QAClF,GAAG,GAAG,IAAI,8BAAC,MAAM,EAAE,GAAG,UAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IALe,wBAAW,cAK1B,CAAA;AAEH,CAAC,EAlIS,YAAY,KAAZ,YAAY,QAkIrB;AAED,kBAAe,YAAY,CAAC"}
+31
View File
@@ -0,0 +1,31 @@
import StackItemFactory from './StackItemFactory.js';
import { Tags } from './Tags.js';
import { SubHandlers } from './MapHandler.js';
import { NodeFactory } from './NodeFactory.js';
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import TexParser from './TexParser.js';
import { OptionList } from '../../util/Options.js';
import { ParserConfiguration } from './Configuration.js';
export default class ParseOptions {
handlers: SubHandlers;
options: OptionList;
itemFactory: StackItemFactory;
nodeFactory: NodeFactory;
tags: Tags;
packageData: Map<string, any>;
parsers: TexParser[];
root: MmlNode;
nodeLists: {
[key: string]: MmlNode[];
};
error: boolean;
constructor(configuration: ParserConfiguration, options?: OptionList[]);
pushParser(parser: TexParser): void;
popParser(): void;
get parser(): TexParser;
clear(): void;
addNode(property: string, node: MmlNode): void;
getList(property: string): MmlNode[];
removeFromList(property: string, nodes: MmlNode[]): void;
private inTree;
}
+147
View File
@@ -0,0 +1,147 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var StackItemFactory_js_1 = __importDefault(require("./StackItemFactory.js"));
var NodeFactory_js_1 = require("./NodeFactory.js");
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var Options_js_1 = require("../../util/Options.js");
var ParseOptions = (function () {
function ParseOptions(configuration, options) {
if (options === void 0) { options = []; }
this.options = {};
this.packageData = new Map();
this.parsers = [];
this.root = null;
this.nodeLists = {};
this.error = false;
this.handlers = configuration.handlers;
this.nodeFactory = new NodeFactory_js_1.NodeFactory();
this.nodeFactory.configuration = this;
this.nodeFactory.setCreators(configuration.nodes);
this.itemFactory = new StackItemFactory_js_1.default(configuration.items);
this.itemFactory.configuration = this;
Options_js_1.defaultOptions.apply(void 0, __spreadArray([this.options], __read(options), false));
(0, Options_js_1.defaultOptions)(this.options, configuration.options);
}
ParseOptions.prototype.pushParser = function (parser) {
this.parsers.unshift(parser);
};
ParseOptions.prototype.popParser = function () {
this.parsers.shift();
};
Object.defineProperty(ParseOptions.prototype, "parser", {
get: function () {
return this.parsers[0];
},
enumerable: false,
configurable: true
});
ParseOptions.prototype.clear = function () {
this.parsers = [];
this.root = null;
this.nodeLists = {};
this.error = false;
this.tags.resetTag();
};
ParseOptions.prototype.addNode = function (property, node) {
var list = this.nodeLists[property];
if (!list) {
list = this.nodeLists[property] = [];
}
list.push(node);
if (node.kind !== property) {
var inlists = (NodeUtil_js_1.default.getProperty(node, 'in-lists') || '');
var lists = (inlists ? inlists.split(/,/) : []).concat(property).join(',');
NodeUtil_js_1.default.setProperty(node, 'in-lists', lists);
}
};
ParseOptions.prototype.getList = function (property) {
var e_1, _a;
var list = this.nodeLists[property] || [];
var result = [];
try {
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
var node = list_1_1.value;
if (this.inTree(node)) {
result.push(node);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
}
finally { if (e_1) throw e_1.error; }
}
this.nodeLists[property] = result;
return result;
};
ParseOptions.prototype.removeFromList = function (property, nodes) {
var e_2, _a;
var list = this.nodeLists[property] || [];
try {
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
var i = list.indexOf(node);
if (i >= 0) {
list.splice(i, 1);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
}
finally { if (e_2) throw e_2.error; }
}
};
ParseOptions.prototype.inTree = function (node) {
while (node && node !== this.root) {
node = node.parent;
}
return !!node;
};
return ParseOptions;
}());
exports.default = ParseOptions;
//# sourceMappingURL=ParseOptions.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ParseOptions.js","sourceRoot":"","sources":["../../../ts/input/tex/ParseOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,8EAAqD;AAGrD,mDAA6C;AAC7C,8DAAqC;AAGrC,oDAAiE;AAOjE;IA0EE,sBAAmB,aAAkC,EAAE,OAA0B;QAA1B,wBAAA,EAAA,YAA0B;QA9D1E,YAAO,GAAe,EAAE,CAAC;QAwBzB,gBAAW,GAAqB,IAAI,GAAG,EAAE,CAAC;QAS1C,YAAO,GAAgB,EAAE,CAAC;QAO1B,SAAI,GAAY,IAAI,CAAC;QAMrB,cAAS,GAA+B,EAAE,CAAC;QAM3C,UAAK,GAAY,KAAK,CAAC;QAW5B,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAEvC,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAW,EAAE,CAAC;QACrC,IAAI,CAAC,WAAW,CAAC,aAAa,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAElD,IAAI,CAAC,WAAW,GAAG,IAAI,6BAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;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AAO,CAAC,CAAC,IAAI,CAAC;IAChB,CAAC;IAEH,mBAAC;AAAD,CAAC,AA1MD,IA0MC"}
+32
View File
@@ -0,0 +1,32 @@
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import { EnvList } from './StackItem.js';
import { ArrayItem } from './base/BaseItems.js';
import ParseOptions from './ParseOptions.js';
import TexParser from './TexParser.js';
declare namespace ParseUtil {
function matchDimen(dim: string, rest?: boolean): [string, string, number];
function dimen2em(dim: string): number;
function Em(m: number): string;
function cols(...W: number[]): string;
function fenced(configuration: ParseOptions, open: string, mml: MmlNode, close: string, big?: string, color?: string): MmlNode;
function fixedFence(configuration: ParseOptions, open: string, mml: MmlNode, close: string): MmlNode;
function mathPalette(configuration: ParseOptions, fence: string, side: string): MmlNode;
function fixInitialMO(configuration: ParseOptions, nodes: MmlNode[]): void;
function internalMath(parser: TexParser, text: string, level?: number | string, font?: string): MmlNode[];
function internalText(parser: TexParser, text: string, def: EnvList): MmlNode;
function underOver(parser: TexParser, base: MmlNode, script: MmlNode, pos: string, stack: boolean): MmlNode;
function checkMovableLimits(base: MmlNode): void;
function trimSpaces(text: string): string;
function setArrayAlign(array: ArrayItem, align: string): ArrayItem;
function substituteArgs(parser: TexParser, args: string[], str: string): string;
function addArgs(parser: TexParser, s1: string, s2: string): string;
function checkMaxMacros(parser: TexParser, isMacro?: boolean): void;
function checkEqnEnv(parser: TexParser): void;
function copyNode(node: MmlNode, parser: TexParser): MmlNode;
function MmlFilterAttribute(_parser: TexParser, _name: string, value: string): string;
function getFontDef(parser: TexParser): EnvList;
function keyvalOptions(attrib: string, allowed?: {
[key: string]: number;
}, error?: boolean): EnvList;
}
export default ParseUtil;
+513
View File
@@ -0,0 +1,513 @@
"use strict";
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var MmlNode_js_1 = require("../../core/MmlTree/MmlNode.js");
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var TexParser_js_1 = __importDefault(require("./TexParser.js"));
var TexError_js_1 = __importDefault(require("./TexError.js"));
var Entities_js_1 = require("../../util/Entities.js");
var ParseUtil;
(function (ParseUtil) {
var emPerInch = 7.2;
var pxPerInch = 72;
var UNIT_CASES = {
'em': function (m) { return m; },
'ex': function (m) { return m * .43; },
'pt': function (m) { return m / 10; },
'pc': function (m) { return m * 1.2; },
'px': function (m) { return m * emPerInch / pxPerInch; },
'in': function (m) { return m * emPerInch; },
'cm': function (m) { return m * emPerInch / 2.54; },
'mm': function (m) { return m * emPerInch / 25.4; },
'mu': function (m) { return m / 18; },
};
var num = '([-+]?([.,]\\d+|\\d+([.,]\\d*)?))';
var unit = '(pt|em|ex|mu|px|mm|cm|in|pc)';
var dimenEnd = RegExp('^\\s*' + num + '\\s*' + unit + '\\s*$');
var dimenRest = RegExp('^\\s*' + num + '\\s*' + unit + ' ?');
function matchDimen(dim, rest) {
if (rest === void 0) { rest = false; }
var match = dim.match(rest ? dimenRest : dimenEnd);
return match ?
muReplace([match[1].replace(/,/, '.'), match[4], match[0].length]) :
[null, null, 0];
}
ParseUtil.matchDimen = matchDimen;
function muReplace(_a) {
var _b = __read(_a, 3), value = _b[0], unit = _b[1], length = _b[2];
if (unit !== 'mu') {
return [value, unit, length];
}
var em = Em(UNIT_CASES[unit](parseFloat(value || '1')));
return [em.slice(0, -2), 'em', length];
}
function dimen2em(dim) {
var _a = __read(matchDimen(dim), 2), value = _a[0], unit = _a[1];
var m = parseFloat(value || '1');
var func = UNIT_CASES[unit];
return func ? func(m) : 0;
}
ParseUtil.dimen2em = dimen2em;
function Em(m) {
if (Math.abs(m) < .0006) {
return '0em';
}
return m.toFixed(3).replace(/\.?0+$/, '') + 'em';
}
ParseUtil.Em = Em;
function cols() {
var W = [];
for (var _i = 0; _i < arguments.length; _i++) {
W[_i] = arguments[_i];
}
return W.map(function (n) { return Em(n); }).join(' ');
}
ParseUtil.cols = cols;
function fenced(configuration, open, mml, close, big, color) {
if (big === void 0) { big = ''; }
if (color === void 0) { color = ''; }
var nf = configuration.nodeFactory;
var mrow = nf.create('node', 'mrow', [], { open: open, close: close, texClass: MmlNode_js_1.TEXCLASS.INNER });
var mo;
if (big) {
mo = new TexParser_js_1.default('\\' + big + 'l' + open, configuration.parser.stack.env, configuration).mml();
}
else {
var openNode = nf.create('text', open);
mo = nf.create('node', 'mo', [], { fence: true, stretchy: true, symmetric: true, texClass: MmlNode_js_1.TEXCLASS.OPEN }, openNode);
}
NodeUtil_js_1.default.appendChildren(mrow, [mo, mml]);
if (big) {
mo = new TexParser_js_1.default('\\' + big + 'r' + close, configuration.parser.stack.env, configuration).mml();
}
else {
var closeNode = nf.create('text', close);
mo = nf.create('node', 'mo', [], { fence: true, stretchy: true, symmetric: true, texClass: MmlNode_js_1.TEXCLASS.CLOSE }, closeNode);
}
color && mo.attributes.set('mathcolor', color);
NodeUtil_js_1.default.appendChildren(mrow, [mo]);
return mrow;
}
ParseUtil.fenced = fenced;
function fixedFence(configuration, open, mml, close) {
var mrow = configuration.nodeFactory.create('node', 'mrow', [], { open: open, close: close, texClass: MmlNode_js_1.TEXCLASS.ORD });
if (open) {
NodeUtil_js_1.default.appendChildren(mrow, [mathPalette(configuration, open, 'l')]);
}
if (NodeUtil_js_1.default.isType(mml, 'mrow')) {
NodeUtil_js_1.default.appendChildren(mrow, NodeUtil_js_1.default.getChildren(mml));
}
else {
NodeUtil_js_1.default.appendChildren(mrow, [mml]);
}
if (close) {
NodeUtil_js_1.default.appendChildren(mrow, [mathPalette(configuration, close, 'r')]);
}
return mrow;
}
ParseUtil.fixedFence = fixedFence;
function mathPalette(configuration, fence, side) {
if (fence === '{' || fence === '}') {
fence = '\\' + fence;
}
var D = '{\\bigg' + side + ' ' + fence + '}';
var T = '{\\big' + side + ' ' + fence + '}';
return new TexParser_js_1.default('\\mathchoice' + D + T + T + T, {}, configuration).mml();
}
ParseUtil.mathPalette = mathPalette;
function fixInitialMO(configuration, nodes) {
for (var i = 0, m = nodes.length; i < m; i++) {
var child = nodes[i];
if (child && (!NodeUtil_js_1.default.isType(child, 'mspace') &&
(!NodeUtil_js_1.default.isType(child, 'TeXAtom') ||
(NodeUtil_js_1.default.getChildren(child)[0] &&
NodeUtil_js_1.default.getChildren(NodeUtil_js_1.default.getChildren(child)[0]).length)))) {
if (NodeUtil_js_1.default.isEmbellished(child) ||
(NodeUtil_js_1.default.isType(child, 'TeXAtom') && NodeUtil_js_1.default.getTexClass(child) === MmlNode_js_1.TEXCLASS.REL)) {
var mi = configuration.nodeFactory.create('node', 'mi');
nodes.unshift(mi);
}
break;
}
}
}
ParseUtil.fixInitialMO = fixInitialMO;
function internalMath(parser, text, level, font) {
if (parser.configuration.options.internalMath) {
return parser.configuration.options.internalMath(parser, text, level, font);
}
var mathvariant = font || parser.stack.env.font;
var def = (mathvariant ? { mathvariant: mathvariant } : {});
var mml = [], i = 0, k = 0, c, node, match = '', braces = 0;
if (text.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)) {
while (i < text.length) {
c = text.charAt(i++);
if (c === '$') {
if (match === '$' && braces === 0) {
node = parser.create('node', 'TeXAtom', [(new TexParser_js_1.default(text.slice(k, i - 1), {}, parser.configuration)).mml()]);
mml.push(node);
match = '';
k = i;
}
else if (match === '') {
if (k < i - 1) {
mml.push(internalText(parser, text.slice(k, i - 1), def));
}
match = '$';
k = i;
}
}
else if (c === '{' && match !== '') {
braces++;
}
else if (c === '}') {
if (match === '}' && braces === 0) {
var atom = (new TexParser_js_1.default(text.slice(k, i), {}, parser.configuration)).mml();
node = parser.create('node', 'TeXAtom', [atom], def);
mml.push(node);
match = '';
k = i;
}
else if (match !== '') {
if (braces) {
braces--;
}
}
}
else if (c === '\\') {
if (match === '' && text.substr(i).match(/^(eq)?ref\s*\{/)) {
var len = RegExp['$&'].length;
if (k < i - 1) {
mml.push(internalText(parser, text.slice(k, i - 1), def));
}
match = '}';
k = i - 1;
i += len;
}
else {
c = text.charAt(i++);
if (c === '(' && match === '') {
if (k < i - 2) {
mml.push(internalText(parser, text.slice(k, i - 2), def));
}
match = ')';
k = i;
}
else if (c === ')' && match === ')' && braces === 0) {
node = parser.create('node', 'TeXAtom', [(new TexParser_js_1.default(text.slice(k, i - 2), {}, parser.configuration)).mml()]);
mml.push(node);
match = '';
k = i;
}
else if (c.match(/[${}\\]/) && match === '') {
i--;
text = text.substr(0, i - 1) + text.substr(i);
}
}
}
}
if (match !== '') {
throw new TexError_js_1.default('MathNotTerminated', 'Math not terminated in text box');
}
}
if (k < text.length) {
mml.push(internalText(parser, text.slice(k), def));
}
if (level != null) {
mml = [parser.create('node', 'mstyle', mml, { displaystyle: false, scriptlevel: level })];
}
else if (mml.length > 1) {
mml = [parser.create('node', 'mrow', mml)];
}
return mml;
}
ParseUtil.internalMath = internalMath;
function internalText(parser, text, def) {
text = text.replace(/^\s+/, Entities_js_1.entities.nbsp).replace(/\s+$/, Entities_js_1.entities.nbsp);
var textNode = parser.create('text', text);
return parser.create('node', 'mtext', [], def, textNode);
}
ParseUtil.internalText = internalText;
function underOver(parser, base, script, pos, stack) {
ParseUtil.checkMovableLimits(base);
if (NodeUtil_js_1.default.isType(base, 'munderover') && NodeUtil_js_1.default.isEmbellished(base)) {
NodeUtil_js_1.default.setProperties(NodeUtil_js_1.default.getCoreMO(base), { lspace: 0, rspace: 0 });
var mo = parser.create('node', 'mo', [], { rspace: 0 });
base = parser.create('node', 'mrow', [mo, base]);
}
var mml = parser.create('node', 'munderover', [base]);
NodeUtil_js_1.default.setChild(mml, pos === 'over' ? mml.over : mml.under, script);
var node = mml;
if (stack) {
node = parser.create('node', 'TeXAtom', [mml], { texClass: MmlNode_js_1.TEXCLASS.OP, movesupsub: true });
}
NodeUtil_js_1.default.setProperty(node, 'subsupOK', true);
return node;
}
ParseUtil.underOver = underOver;
function checkMovableLimits(base) {
var symbol = (NodeUtil_js_1.default.isType(base, 'mo') ? NodeUtil_js_1.default.getForm(base) : null);
if (NodeUtil_js_1.default.getProperty(base, 'movablelimits') || (symbol && symbol[3] && symbol[3].movablelimits)) {
NodeUtil_js_1.default.setProperties(base, { movablelimits: false });
}
}
ParseUtil.checkMovableLimits = checkMovableLimits;
function trimSpaces(text) {
if (typeof (text) !== 'string') {
return text;
}
var TEXT = text.trim();
if (TEXT.match(/\\$/) && text.match(/ $/)) {
TEXT += ' ';
}
return TEXT;
}
ParseUtil.trimSpaces = trimSpaces;
function setArrayAlign(array, align) {
align = ParseUtil.trimSpaces(align || '');
if (align === 't') {
array.arraydef.align = 'baseline 1';
}
else if (align === 'b') {
array.arraydef.align = 'baseline -1';
}
else if (align === 'c') {
array.arraydef.align = 'axis';
}
else if (align) {
array.arraydef.align = align;
}
return array;
}
ParseUtil.setArrayAlign = setArrayAlign;
function substituteArgs(parser, args, str) {
var text = '';
var newstring = '';
var i = 0;
while (i < str.length) {
var c = str.charAt(i++);
if (c === '\\') {
text += c + str.charAt(i++);
}
else if (c === '#') {
c = str.charAt(i++);
if (c === '#') {
text += c;
}
else {
if (!c.match(/[1-9]/) || parseInt(c, 10) > args.length) {
throw new TexError_js_1.default('IllegalMacroParam', 'Illegal macro parameter reference');
}
newstring = addArgs(parser, addArgs(parser, newstring, text), args[parseInt(c, 10) - 1]);
text = '';
}
}
else {
text += c;
}
}
return addArgs(parser, newstring, text);
}
ParseUtil.substituteArgs = substituteArgs;
function addArgs(parser, s1, s2) {
if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {
s1 += ' ';
}
if (s1.length + s2.length > parser.configuration.options['maxBuffer']) {
throw new TexError_js_1.default('MaxBufferSize', 'MathJax internal buffer size exceeded; is there a' +
' recursive macro call?');
}
return s1 + s2;
}
ParseUtil.addArgs = addArgs;
function checkMaxMacros(parser, isMacro) {
if (isMacro === void 0) { isMacro = true; }
if (++parser.macroCount <= parser.configuration.options['maxMacros']) {
return;
}
if (isMacro) {
throw new TexError_js_1.default('MaxMacroSub1', 'MathJax maximum macro substitution count exceeded; ' +
'is here a recursive macro call?');
}
else {
throw new TexError_js_1.default('MaxMacroSub2', 'MathJax maximum substitution count exceeded; ' +
'is there a recursive latex environment?');
}
}
ParseUtil.checkMaxMacros = checkMaxMacros;
function checkEqnEnv(parser) {
if (parser.stack.global.eqnenv) {
throw new TexError_js_1.default('ErroneousNestingEq', 'Erroneous nesting of equation structures');
}
parser.stack.global.eqnenv = true;
}
ParseUtil.checkEqnEnv = checkEqnEnv;
function copyNode(node, parser) {
var tree = node.copy();
var options = parser.configuration;
tree.walkTree(function (n) {
var e_1, _a;
options.addNode(n.kind, n);
var lists = (n.getProperty('in-lists') || '').split(/,/);
try {
for (var lists_1 = __values(lists), lists_1_1 = lists_1.next(); !lists_1_1.done; lists_1_1 = lists_1.next()) {
var list = lists_1_1.value;
list && options.addNode(list, n);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (lists_1_1 && !lists_1_1.done && (_a = lists_1.return)) _a.call(lists_1);
}
finally { if (e_1) throw e_1.error; }
}
});
return tree;
}
ParseUtil.copyNode = copyNode;
function MmlFilterAttribute(_parser, _name, value) {
return value;
}
ParseUtil.MmlFilterAttribute = MmlFilterAttribute;
function getFontDef(parser) {
var font = parser.stack.env['font'];
return (font ? { mathvariant: font } : {});
}
ParseUtil.getFontDef = getFontDef;
function keyvalOptions(attrib, allowed, error) {
var e_2, _a;
if (allowed === void 0) { allowed = null; }
if (error === void 0) { error = false; }
var def = readKeyval(attrib);
if (allowed) {
try {
for (var _b = __values(Object.keys(def)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
if (!allowed.hasOwnProperty(key)) {
if (error) {
throw new TexError_js_1.default('InvalidOption', 'Invalid option: %1', key);
}
delete def[key];
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
}
return def;
}
ParseUtil.keyvalOptions = keyvalOptions;
function readKeyval(text) {
var _a, _b;
var options = {};
var rest = text;
var end, key, val;
while (rest) {
_a = __read(readValue(rest, ['=', ',']), 3), key = _a[0], end = _a[1], rest = _a[2];
if (end === '=') {
_b = __read(readValue(rest, [',']), 3), val = _b[0], end = _b[1], rest = _b[2];
val = (val === 'false' || val === 'true') ?
JSON.parse(val) : val;
options[key] = val;
}
else if (key) {
options[key] = true;
}
}
return options;
}
function removeBraces(text, count) {
while (count > 0) {
text = text.trim().slice(1, -1);
count--;
}
return text.trim();
}
function readValue(text, end) {
var length = text.length;
var braces = 0;
var value = '';
var index = 0;
var start = 0;
var startCount = true;
var stopCount = false;
while (index < length) {
var c = text[index++];
switch (c) {
case ' ':
break;
case '{':
if (startCount) {
start++;
}
else {
stopCount = false;
if (start > braces) {
start = braces;
}
}
braces++;
break;
case '}':
if (braces) {
braces--;
}
if (startCount || stopCount) {
start--;
stopCount = true;
}
startCount = false;
break;
default:
if (!braces && end.indexOf(c) !== -1) {
return [stopCount ? 'true' :
removeBraces(value, start), c, text.slice(index)];
}
startCount = false;
stopCount = false;
}
value += c;
}
if (braces) {
throw new TexError_js_1.default('ExtraOpenMissingClose', 'Extra open brace or missing close brace');
}
return [stopCount ? 'true' : removeBraces(value, start), '', text.slice(index)];
}
})(ParseUtil || (ParseUtil = {}));
exports.default = ParseUtil;
//# sourceMappingURL=ParseUtil.js.map
File diff suppressed because one or more lines are too long
+17
View File
@@ -0,0 +1,17 @@
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import { StackItem, EnvList } from './StackItem.js';
import StackItemFactory from './StackItemFactory.js';
export default class Stack {
private _factory;
private _env;
global: EnvList;
private stack;
constructor(_factory: StackItemFactory, _env: EnvList, inner: boolean);
set env(env: EnvList);
get env(): EnvList;
Push(...args: (StackItem | MmlNode)[]): void;
Pop(): StackItem;
Top(n?: number): StackItem;
Prev(noPop?: boolean): MmlNode | void;
toString(): string;
}
+132
View File
@@ -0,0 +1,132 @@
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var NodeUtil_js_1 = __importDefault(require("./NodeUtil.js"));
var Stack = (function () {
function Stack(_factory, _env, inner) {
this._factory = _factory;
this._env = _env;
this.global = {};
this.stack = [];
this.global = { isInner: inner };
this.stack = [this._factory.create('start', this.global)];
if (_env) {
this.stack[0].env = _env;
}
this.env = this.stack[0].env;
}
Object.defineProperty(Stack.prototype, "env", {
get: function () {
return this._env;
},
set: function (env) {
this._env = env;
},
enumerable: false,
configurable: true
});
Stack.prototype.Push = function () {
var e_1, _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
try {
for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) {
var node = args_1_1.value;
if (!node) {
continue;
}
var item = NodeUtil_js_1.default.isNode(node) ?
this._factory.create('mml', node) : node;
item.global = this.global;
var _b = __read(this.stack.length ? this.Top().checkItem(item) : [null, true], 2), top_1 = _b[0], success = _b[1];
if (!success) {
continue;
}
if (top_1) {
this.Pop();
this.Push.apply(this, __spreadArray([], __read(top_1), false));
continue;
}
this.stack.push(item);
if (item.env) {
if (item.copyEnv) {
Object.assign(item.env, this.env);
}
this.env = item.env;
}
else {
item.env = this.env;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (args_1_1 && !args_1_1.done && (_a = args_1.return)) _a.call(args_1);
}
finally { if (e_1) throw e_1.error; }
}
};
Stack.prototype.Pop = function () {
var item = this.stack.pop();
if (!item.isOpen) {
delete item.env;
}
this.env = (this.stack.length ? this.Top().env : {});
return item;
};
Stack.prototype.Top = function (n) {
if (n === void 0) { n = 1; }
return this.stack.length < n ? null : this.stack[this.stack.length - n];
};
Stack.prototype.Prev = function (noPop) {
var top = this.Top();
return noPop ? top.First : top.Pop();
};
Stack.prototype.toString = function () {
return 'stack[\n ' + this.stack.join('\n ') + '\n]';
};
return Stack;
}());
exports.default = Stack;
//# sourceMappingURL=Stack.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../../ts/input/tex/Stack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1E,CAAC;IASM,oBAAI,GAAX,UAAY,KAAe;QACzB,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACvC,CAAC;IAMM,wBAAQ,GAAf;QACE,OAAO,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACxD,CAAC;IAEH,YAAC;AAAD,CAAC,AA9HD,IA8HC"}
+84
View File
@@ -0,0 +1,84 @@
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import { FactoryNodeClass } from '../../core/Tree/Factory.js';
import StackItemFactory from './StackItemFactory.js';
export declare type EnvProp = string | number | boolean;
export declare type EnvList = {
[key: string]: EnvProp;
};
export declare type Prop = string | number | boolean | MmlNode | PropList;
export declare type PropList = {
[key: string]: Prop;
};
export declare type CheckType = [(MmlNode | StackItem)[], boolean];
export interface NodeStack {
First: MmlNode;
Last: MmlNode;
Pop(): MmlNode | void;
Push(...nodes: MmlNode[]): void;
Peek(n?: number): MmlNode[];
Size(): number;
Clear(): void;
toMml(inferred?: boolean, forceRow?: boolean): MmlNode;
}
export declare abstract class MmlStack implements NodeStack {
private _nodes;
constructor(_nodes: MmlNode[]);
protected get nodes(): MmlNode[];
Push(...nodes: MmlNode[]): void;
Pop(): MmlNode;
get First(): MmlNode;
set First(node: MmlNode);
get Last(): MmlNode;
set Last(node: MmlNode);
Peek(n?: number): MmlNode[];
Size(): number;
Clear(): void;
protected abstract get factory(): StackItemFactory;
toMml(inferred?: boolean, forceRow?: boolean): MmlNode;
create(kind: string, ...rest: any[]): MmlNode;
}
export interface StackItem extends NodeStack {
kind: string;
isClose: boolean;
isOpen: boolean;
isFinal: boolean;
global: EnvList;
env: EnvList;
copyEnv: boolean;
isKind(kind: string): boolean;
getProperty(key: string): Prop;
setProperty(key: string, value: Prop): StackItem;
setProperties(def: PropList): StackItem;
getName(): string;
checkItem(item: StackItem): CheckType;
}
export interface StackItemClass extends FactoryNodeClass<StackItem> {
}
export declare abstract class BaseItem extends MmlStack implements StackItem {
protected factory: StackItemFactory;
protected static fail: CheckType;
protected static success: CheckType;
protected static errors: {
[key: string]: string[];
};
global: EnvList;
private _env;
private _properties;
constructor(factory: StackItemFactory, ...nodes: MmlNode[]);
get kind(): string;
get env(): EnvList;
set env(value: EnvList);
get copyEnv(): boolean;
getProperty(key: string): Prop;
setProperty(key: string, value: Prop): this;
get isOpen(): boolean;
get isClose(): boolean;
get isFinal(): boolean;
isKind(kind: string): boolean;
checkItem(item: StackItem): CheckType;
clearEnv(): void;
setProperties(def: PropList): this;
getName(): string;
toString(): string;
getErrors(kind: string): string[];
}
+264
View File
@@ -0,0 +1,264 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseItem = exports.MmlStack = void 0;
var TexError_js_1 = __importDefault(require("./TexError.js"));
var MmlStack = (function () {
function MmlStack(_nodes) {
this._nodes = _nodes;
}
Object.defineProperty(MmlStack.prototype, "nodes", {
get: function () {
return this._nodes;
},
enumerable: false,
configurable: true
});
MmlStack.prototype.Push = function () {
var _a;
var nodes = [];
for (var _i = 0; _i < arguments.length; _i++) {
nodes[_i] = arguments[_i];
}
(_a = this._nodes).push.apply(_a, __spreadArray([], __read(nodes), false));
};
MmlStack.prototype.Pop = function () {
return this._nodes.pop();
};
Object.defineProperty(MmlStack.prototype, "First", {
get: function () {
return this._nodes[this.Size() - 1];
},
set: function (node) {
this._nodes[this.Size() - 1] = node;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MmlStack.prototype, "Last", {
get: function () {
return this._nodes[0];
},
set: function (node) {
this._nodes[0] = node;
},
enumerable: false,
configurable: true
});
MmlStack.prototype.Peek = function (n) {
if (n == null) {
n = 1;
}
return this._nodes.slice(this.Size() - n);
};
MmlStack.prototype.Size = function () {
return this._nodes.length;
};
MmlStack.prototype.Clear = function () {
this._nodes = [];
};
MmlStack.prototype.toMml = function (inferred, forceRow) {
if (inferred === void 0) { inferred = true; }
if (this._nodes.length === 1 && !forceRow) {
return this.First;
}
return this.create('node', inferred ? 'inferredMrow' : 'mrow', this._nodes, {});
};
MmlStack.prototype.create = function (kind) {
var _a;
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
return (_a = this.factory.configuration.nodeFactory).create.apply(_a, __spreadArray([kind], __read(rest), false));
};
return MmlStack;
}());
exports.MmlStack = MmlStack;
var BaseItem = (function (_super) {
__extends(BaseItem, _super);
function BaseItem(factory) {
var nodes = [];
for (var _i = 1; _i < arguments.length; _i++) {
nodes[_i - 1] = arguments[_i];
}
var _this = _super.call(this, nodes) || this;
_this.factory = factory;
_this.global = {};
_this._properties = {};
if (_this.isOpen) {
_this._env = {};
}
return _this;
}
Object.defineProperty(BaseItem.prototype, "kind", {
get: function () {
return 'base';
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseItem.prototype, "env", {
get: function () {
return this._env;
},
set: function (value) {
this._env = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseItem.prototype, "copyEnv", {
get: function () {
return true;
},
enumerable: false,
configurable: true
});
BaseItem.prototype.getProperty = function (key) {
return this._properties[key];
};
BaseItem.prototype.setProperty = function (key, value) {
this._properties[key] = value;
return this;
};
Object.defineProperty(BaseItem.prototype, "isOpen", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseItem.prototype, "isClose", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BaseItem.prototype, "isFinal", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
BaseItem.prototype.isKind = function (kind) {
return kind === this.kind;
};
BaseItem.prototype.checkItem = function (item) {
if (item.isKind('over') && this.isOpen) {
item.setProperty('num', this.toMml(false));
this.Clear();
}
if (item.isKind('cell') && this.isOpen) {
if (item.getProperty('linebreak')) {
return BaseItem.fail;
}
throw new TexError_js_1.default('Misplaced', 'Misplaced %1', item.getName());
}
if (item.isClose && this.getErrors(item.kind)) {
var _a = __read(this.getErrors(item.kind), 2), id = _a[0], message = _a[1];
throw new TexError_js_1.default(id, message, item.getName());
}
if (!item.isFinal) {
return BaseItem.success;
}
this.Push(item.First);
return BaseItem.fail;
};
BaseItem.prototype.clearEnv = function () {
var e_1, _a;
try {
for (var _b = __values(Object.keys(this.env)), _c = _b.next(); !_c.done; _c = _b.next()) {
var id = _c.value;
delete this.env[id];
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
BaseItem.prototype.setProperties = function (def) {
Object.assign(this._properties, def);
return this;
};
BaseItem.prototype.getName = function () {
return this.getProperty('name');
};
BaseItem.prototype.toString = function () {
return this.kind + '[' + this.nodes.join('; ') + ']';
};
BaseItem.prototype.getErrors = function (kind) {
var CLASS = this.constructor;
return (CLASS.errors || {})[kind] || BaseItem.errors[kind];
};
BaseItem.fail = [null, false];
BaseItem.success = [null, true];
BaseItem.errors = {
end: ['MissingBeginExtraEnd', 'Missing \\begin{%1} or extra \\end{%1}'],
close: ['ExtraCloseMissingOpen', 'Extra close brace or missing open brace'],
right: ['MissingLeftExtraRight', 'Missing \\left or extra \\right'],
middle: ['ExtraMiddle', 'Extra \\middle']
};
return BaseItem;
}(MmlStack));
exports.BaseItem = BaseItem;
//# sourceMappingURL=StackItem.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"StackItem.js","sourceRoot":"","sources":["../../../ts/input/tex/StackItem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,8DAAqC;AAuErC;IAOE,kBAAoB,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAI,CAAC;IAK1C,sBAAc,2BAAK;aAAnB;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAKM,uBAAI,GAAX;;QAAY,e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EAAE,yCAAyC,CAAC;QAE3E,KAAK,EAAE,CAAC,uBAAuB,EAAE,iCAAiC,CAAC;QACnE,MAAM,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC;KAC1C,CAAC;IAmLJ,eAAC;CAAA,AA7MD,CAAuC,QAAQ,GA6M9C;AA7MqB,4BAAQ"}
+10
View File
@@ -0,0 +1,10 @@
import { StackItemClass, StackItem } from './StackItem.js';
import ParseOptions from './ParseOptions.js';
import { AbstractFactory } from '../../core/Tree/Factory.js';
export default class StackItemFactory extends AbstractFactory<StackItem, StackItemClass> {
static DefaultStackItems: {
[kind: string]: StackItemClass;
};
defaultKind: string;
configuration: ParseOptions;
}
+42
View File
@@ -0,0 +1,42 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var StackItem_js_1 = require("./StackItem.js");
var Factory_js_1 = require("../../core/Tree/Factory.js");
var DummyItem = (function (_super) {
__extends(DummyItem, _super);
function DummyItem() {
return _super !== null && _super.apply(this, arguments) || this;
}
return DummyItem;
}(StackItem_js_1.BaseItem));
var StackItemFactory = (function (_super) {
__extends(StackItemFactory, _super);
function StackItemFactory() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.defaultKind = 'dummy';
_this.configuration = null;
return _this;
}
StackItemFactory.DefaultStackItems = (_a = {},
_a[DummyItem.prototype.kind] = DummyItem,
_a);
return StackItemFactory;
}(Factory_js_1.AbstractFactory));
exports.default = StackItemFactory;
//# sourceMappingURL=StackItemFactory.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"StackItemFactory.js","sourceRoot":"","sources":["../../../ts/input/tex/StackItemFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,+CAAmE;AAEnE,yDAA2D;AAG3D;IAAwB,6BAAQ;IAAhC;;IAAkC,CAAC;IAAD,gBAAC;AAAD,CAAC,AAAnC,CAAwB,uBAAQ,GAAG;AASnC;IAA8C,oCAA0C;IAAxF;QAAA,qEAsBC;QATQ,iBAAW,GAAG,OAAO,CAAC;QAOtB,mBAAa,GAAiB,IAAI,CAAC;;IAE5C,CAAC;IAjBe,kCAAiB;QAC7B,GAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAG,SAAS;YACrC;IAeJ,uBAAC;CAAA,AAtBD,CAA8C,4BAAe,GAsB5D;kBAtBoB,gBAAgB"}
+19
View File
@@ -0,0 +1,19 @@
import { Args, Attributes, ParseMethod } from './Types.js';
export declare class Symbol {
private _symbol;
private _char;
private _attributes;
constructor(_symbol: string, _char: string, _attributes: Attributes);
get symbol(): string;
get char(): string;
get attributes(): Attributes;
}
export declare class Macro {
private _symbol;
private _func;
private _args;
constructor(_symbol: string, _func: ParseMethod, _args?: Args[]);
get symbol(): string;
get func(): ParseMethod;
get args(): Args[];
}
+65
View File
@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Macro = exports.Symbol = void 0;
var Symbol = (function () {
function Symbol(_symbol, _char, _attributes) {
this._symbol = _symbol;
this._char = _char;
this._attributes = _attributes;
}
Object.defineProperty(Symbol.prototype, "symbol", {
get: function () {
return this._symbol;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Symbol.prototype, "char", {
get: function () {
return this._char;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Symbol.prototype, "attributes", {
get: function () {
return this._attributes;
},
enumerable: false,
configurable: true
});
return Symbol;
}());
exports.Symbol = Symbol;
var Macro = (function () {
function Macro(_symbol, _func, _args) {
if (_args === void 0) { _args = []; }
this._symbol = _symbol;
this._func = _func;
this._args = _args;
}
Object.defineProperty(Macro.prototype, "symbol", {
get: function () {
return this._symbol;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Macro.prototype, "func", {
get: function () {
return this._func;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Macro.prototype, "args", {
get: function () {
return this._args;
},
enumerable: false,
configurable: true
});
return Macro;
}());
exports.Macro = Macro;
//# sourceMappingURL=Symbol.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Symbol.js","sourceRoot":"","sources":["../../../ts/input/tex/Symbol.ts"],"names":[],"mappings":";;;AA8BA;IAQE,gBAAoB,OAAe,EAAU,KAAa,EACtC,WAAuB;QADvB,YAAO,GAAP,OAAO,CAAQ;QAAU,UAAK,GAAL,KAAK,CAAQ;QACtC,gBAAW,GAAX,WAAW,CAAY;IAC3C,CAAC;IAED,sBAAW,0BAAM;aAAjB;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAED,sBAAW,wBAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAED,sBAAW,8BAAU;aAArB;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;;;OAAA;IAEH,aAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,wBAAM;AA2BnB;IAQE,eAAoB,OAAe,EAAU,KAAkB,EAC3C,KAAkB;QAAlB,sBAAA,EAAA,UAAkB;QADlB,YAAO,GAAP,OAAO,CAAQ;QAAU,UAAK,GAAL,KAAK,CAAa;QAC3C,UAAK,GAAL,KAAK,CAAa;IACtC,CAAC;IAED,sBAAW,yBAAM;aAAjB;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAED,sBAAW,uBAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAED,sBAAW,uBAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAEH,YAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,sBAAK"}
+59
View File
@@ -0,0 +1,59 @@
import { Attributes, Args, ParseMethod, ParseInput, ParseResult } from './Types.js';
import { Symbol, Macro } from './Symbol.js';
export interface SymbolMap {
name: string;
parser: ParseMethod;
contains(symbol: string): boolean;
parserFor(symbol: string): ParseMethod;
parse([env, symbol]: ParseInput): ParseResult;
}
export declare function parseResult(result: ParseResult): ParseResult;
export declare abstract class AbstractSymbolMap<T> implements SymbolMap {
private _name;
private _parser;
constructor(_name: string, _parser: ParseMethod);
get name(): string;
abstract contains(symbol: string): boolean;
parserFor(symbol: string): ParseMethod;
parse([env, symbol]: ParseInput): ParseResult;
set parser(parser: ParseMethod);
get parser(): ParseMethod;
abstract lookup(symbol: string): T;
}
export declare class RegExpMap extends AbstractSymbolMap<string> {
private _regExp;
constructor(name: string, parser: ParseMethod, _regExp: RegExp);
contains(symbol: string): boolean;
lookup(symbol: string): string;
}
export declare abstract class AbstractParseMap<K> extends AbstractSymbolMap<K> {
private map;
lookup(symbol: string): K;
contains(symbol: string): boolean;
add(symbol: string, object: K): void;
remove(symbol: string): void;
}
export declare class CharacterMap extends AbstractParseMap<Symbol> {
constructor(name: string, parser: ParseMethod, json: {
[index: string]: string | [string, Attributes];
});
}
export declare class DelimiterMap extends CharacterMap {
parse([env, symbol]: ParseInput): ParseResult;
}
export declare class MacroMap extends AbstractParseMap<Macro> {
constructor(name: string, json: {
[index: string]: string | Args[];
}, functionMap: Record<string, ParseMethod>);
parserFor(symbol: string): ParseMethod;
parse([env, symbol]: ParseInput): ParseResult;
}
export declare class CommandMap extends MacroMap {
parse([env, symbol]: ParseInput): ParseResult;
}
export declare class EnvironmentMap extends MacroMap {
constructor(name: string, parser: ParseMethod, json: {
[index: string]: string | Args[];
}, functionMap: Record<string, ParseMethod>);
parse([env, symbol]: ParseInput): ParseResult;
}
+251
View File
@@ -0,0 +1,251 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentMap = exports.CommandMap = exports.MacroMap = exports.DelimiterMap = exports.CharacterMap = exports.AbstractParseMap = exports.RegExpMap = exports.AbstractSymbolMap = exports.parseResult = void 0;
var Symbol_js_1 = require("./Symbol.js");
var MapHandler_js_1 = require("./MapHandler.js");
function parseResult(result) {
return result === void 0 ? true : result;
}
exports.parseResult = parseResult;
var AbstractSymbolMap = (function () {
function AbstractSymbolMap(_name, _parser) {
this._name = _name;
this._parser = _parser;
MapHandler_js_1.MapHandler.register(this);
}
Object.defineProperty(AbstractSymbolMap.prototype, "name", {
get: function () {
return this._name;
},
enumerable: false,
configurable: true
});
AbstractSymbolMap.prototype.parserFor = function (symbol) {
return this.contains(symbol) ? this.parser : null;
};
AbstractSymbolMap.prototype.parse = function (_a) {
var _b = __read(_a, 2), env = _b[0], symbol = _b[1];
var parser = this.parserFor(symbol);
var mapped = this.lookup(symbol);
return (parser && mapped) ? parseResult(parser(env, mapped)) : null;
};
Object.defineProperty(AbstractSymbolMap.prototype, "parser", {
get: function () {
return this._parser;
},
set: function (parser) {
this._parser = parser;
},
enumerable: false,
configurable: true
});
return AbstractSymbolMap;
}());
exports.AbstractSymbolMap = AbstractSymbolMap;
var RegExpMap = (function (_super) {
__extends(RegExpMap, _super);
function RegExpMap(name, parser, _regExp) {
var _this = _super.call(this, name, parser) || this;
_this._regExp = _regExp;
return _this;
}
RegExpMap.prototype.contains = function (symbol) {
return this._regExp.test(symbol);
};
RegExpMap.prototype.lookup = function (symbol) {
return this.contains(symbol) ? symbol : null;
};
return RegExpMap;
}(AbstractSymbolMap));
exports.RegExpMap = RegExpMap;
var AbstractParseMap = (function (_super) {
__extends(AbstractParseMap, _super);
function AbstractParseMap() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.map = new Map();
return _this;
}
AbstractParseMap.prototype.lookup = function (symbol) {
return this.map.get(symbol);
};
AbstractParseMap.prototype.contains = function (symbol) {
return this.map.has(symbol);
};
AbstractParseMap.prototype.add = function (symbol, object) {
this.map.set(symbol, object);
};
AbstractParseMap.prototype.remove = function (symbol) {
this.map.delete(symbol);
};
return AbstractParseMap;
}(AbstractSymbolMap));
exports.AbstractParseMap = AbstractParseMap;
var CharacterMap = (function (_super) {
__extends(CharacterMap, _super);
function CharacterMap(name, parser, json) {
var e_1, _a;
var _this = _super.call(this, name, parser) || this;
try {
for (var _b = __values(Object.keys(json)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
var value = json[key];
var _d = __read((typeof (value) === 'string') ? [value, null] : value, 2), char = _d[0], attrs = _d[1];
var character = new Symbol_js_1.Symbol(key, char, attrs);
_this.add(key, character);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return _this;
}
return CharacterMap;
}(AbstractParseMap));
exports.CharacterMap = CharacterMap;
var DelimiterMap = (function (_super) {
__extends(DelimiterMap, _super);
function DelimiterMap() {
return _super !== null && _super.apply(this, arguments) || this;
}
DelimiterMap.prototype.parse = function (_a) {
var _b = __read(_a, 2), env = _b[0], symbol = _b[1];
return _super.prototype.parse.call(this, [env, '\\' + symbol]);
};
return DelimiterMap;
}(CharacterMap));
exports.DelimiterMap = DelimiterMap;
var MacroMap = (function (_super) {
__extends(MacroMap, _super);
function MacroMap(name, json, functionMap) {
var e_2, _a;
var _this = _super.call(this, name, null) || this;
try {
for (var _b = __values(Object.keys(json)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
var value = json[key];
var _d = __read((typeof (value) === 'string') ? [value] : value), func = _d[0], attrs = _d.slice(1);
var character = new Symbol_js_1.Macro(key, functionMap[func], attrs);
_this.add(key, character);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
return _this;
}
MacroMap.prototype.parserFor = function (symbol) {
var macro = this.lookup(symbol);
return macro ? macro.func : null;
};
MacroMap.prototype.parse = function (_a) {
var _b = __read(_a, 2), env = _b[0], symbol = _b[1];
var macro = this.lookup(symbol);
var parser = this.parserFor(symbol);
if (!macro || !parser) {
return null;
}
return parseResult(parser.apply(void 0, __spreadArray([env, macro.symbol], __read(macro.args), false)));
};
return MacroMap;
}(AbstractParseMap));
exports.MacroMap = MacroMap;
var CommandMap = (function (_super) {
__extends(CommandMap, _super);
function CommandMap() {
return _super !== null && _super.apply(this, arguments) || this;
}
CommandMap.prototype.parse = function (_a) {
var _b = __read(_a, 2), env = _b[0], symbol = _b[1];
var macro = this.lookup(symbol);
var parser = this.parserFor(symbol);
if (!macro || !parser) {
return null;
}
var saveCommand = env.currentCS;
env.currentCS = '\\' + symbol;
var result = parser.apply(void 0, __spreadArray([env, '\\' + macro.symbol], __read(macro.args), false));
env.currentCS = saveCommand;
return parseResult(result);
};
return CommandMap;
}(MacroMap));
exports.CommandMap = CommandMap;
var EnvironmentMap = (function (_super) {
__extends(EnvironmentMap, _super);
function EnvironmentMap(name, parser, json, functionMap) {
var _this = _super.call(this, name, json, functionMap) || this;
_this.parser = parser;
return _this;
}
EnvironmentMap.prototype.parse = function (_a) {
var _b = __read(_a, 2), env = _b[0], symbol = _b[1];
var macro = this.lookup(symbol);
var envParser = this.parserFor(symbol);
if (!macro || !envParser) {
return null;
}
return parseResult(this.parser(env, macro.symbol, envParser, macro.args));
};
return EnvironmentMap;
}(MacroMap));
exports.EnvironmentMap = EnvironmentMap;
//# sourceMappingURL=SymbolMap.js.map
File diff suppressed because one or more lines are too long
+121
View File
@@ -0,0 +1,121 @@
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
import { MathItem } from '../../core/MathItem.js';
import { EnvList } from './StackItem.js';
import ParseOptions from './ParseOptions.js';
import { OptionList } from '../../util/Options.js';
export declare class Label {
tag: string;
id: string;
constructor(tag?: string, id?: string);
}
export declare class TagInfo {
readonly env: string;
readonly taggable: boolean;
readonly defaultTags: boolean;
tag: string;
tagId: string;
tagFormat: string;
noTag: boolean;
labelId: string;
constructor(env?: string, taggable?: boolean, defaultTags?: boolean, tag?: string, tagId?: string, tagFormat?: string, noTag?: boolean, labelId?: string);
}
export interface Tags {
configuration: ParseOptions;
ids: {
[key: string]: boolean;
};
allIds: {
[key: string]: boolean;
};
labels: {
[key: string]: Label;
};
allLabels: {
[key: string]: Label;
};
label: string;
redo: boolean;
refUpdate: boolean;
env: string;
currentTag: TagInfo;
formatTag(tag: string): string;
formatUrl(id: string, base: string): string;
autoTag(): void;
getTag(): MmlNode | void;
clearTag(): void;
resetTag(): void;
reset(offset?: number): void;
startEquation(math: MathItem<any, any, any>): void;
finishEquation(math: MathItem<any, any, any>): void;
finalize(node: MmlNode, env: EnvList): MmlNode;
start(env: string, taggable: boolean, defaultTags: boolean): void;
end(): void;
tag(tag: string, noFormat: boolean): void;
notag(): void;
enTag(node: MmlNode, tag: MmlNode): MmlNode;
}
export declare class AbstractTags implements Tags {
protected counter: number;
protected allCounter: number;
configuration: ParseOptions;
ids: {
[key: string]: boolean;
};
allIds: {
[key: string]: boolean;
};
labels: {
[key: string]: Label;
};
allLabels: {
[key: string]: Label;
};
redo: boolean;
refUpdate: boolean;
currentTag: TagInfo;
protected history: TagInfo[];
private stack;
start(env: string, taggable: boolean, defaultTags: boolean): void;
get env(): string;
end(): void;
tag(tag: string, noFormat: boolean): void;
notag(): void;
protected get noTag(): boolean;
set label(label: string);
get label(): string;
formatUrl(id: string, base: string): string;
formatTag(tag: string): string;
protected formatId(id: string): string;
protected formatNumber(n: number): string;
autoTag(): void;
clearTag(): void;
getTag(force?: boolean): MmlNode;
resetTag(): void;
reset(offset?: number): void;
startEquation(math: MathItem<any, any, any>): void;
finishEquation(math: MathItem<any, any, any>): void;
finalize(node: MmlNode, env: EnvList): MmlNode;
enTag: (node: MmlNode, tag: MmlNode) => MmlNode;
private makeId;
private makeTag;
}
export declare class NoTags extends AbstractTags {
autoTag(): void;
getTag(): MmlNode;
}
export declare class AllTags extends AbstractTags {
finalize(node: MmlNode, env: EnvList): MmlNode;
}
export interface TagsClass {
new (): Tags;
}
export declare namespace TagsFactory {
let OPTIONS: OptionList;
let add: (name: string, constr: TagsClass) => void;
let addTags: (tags: {
[name: string]: TagsClass;
}) => void;
let create: (name: string) => Tags;
let setDefault: (name: string) => void;
let getDefault: () => Tags;
}
+314
View File
@@ -0,0 +1,314 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagsFactory = exports.AllTags = exports.NoTags = exports.AbstractTags = exports.TagInfo = exports.Label = void 0;
var TexParser_js_1 = __importDefault(require("./TexParser.js"));
var Label = (function () {
function Label(tag, id) {
if (tag === void 0) { tag = '???'; }
if (id === void 0) { id = ''; }
this.tag = tag;
this.id = id;
}
return Label;
}());
exports.Label = Label;
var TagInfo = (function () {
function TagInfo(env, taggable, defaultTags, tag, tagId, tagFormat, noTag, labelId) {
if (env === void 0) { env = ''; }
if (taggable === void 0) { taggable = false; }
if (defaultTags === void 0) { defaultTags = false; }
if (tag === void 0) { tag = null; }
if (tagId === void 0) { tagId = ''; }
if (tagFormat === void 0) { tagFormat = ''; }
if (noTag === void 0) { noTag = false; }
if (labelId === void 0) { labelId = ''; }
this.env = env;
this.taggable = taggable;
this.defaultTags = defaultTags;
this.tag = tag;
this.tagId = tagId;
this.tagFormat = tagFormat;
this.noTag = noTag;
this.labelId = labelId;
}
return TagInfo;
}());
exports.TagInfo = TagInfo;
var AbstractTags = (function () {
function AbstractTags() {
this.counter = 0;
this.allCounter = 0;
this.configuration = null;
this.ids = {};
this.allIds = {};
this.labels = {};
this.allLabels = {};
this.redo = false;
this.refUpdate = false;
this.currentTag = new TagInfo();
this.history = [];
this.stack = [];
this.enTag = function (node, tag) {
var nf = this.configuration.nodeFactory;
var cell = nf.create('node', 'mtd', [node]);
var row = nf.create('node', 'mlabeledtr', [tag, cell]);
var table = nf.create('node', 'mtable', [row], {
side: this.configuration.options['tagSide'],
minlabelspacing: this.configuration.options['tagIndent'],
displaystyle: true
});
return table;
};
}
AbstractTags.prototype.start = function (env, taggable, defaultTags) {
if (this.currentTag) {
this.stack.push(this.currentTag);
}
this.currentTag = new TagInfo(env, taggable, defaultTags);
};
Object.defineProperty(AbstractTags.prototype, "env", {
get: function () {
return this.currentTag.env;
},
enumerable: false,
configurable: true
});
AbstractTags.prototype.end = function () {
this.history.push(this.currentTag);
this.currentTag = this.stack.pop();
};
AbstractTags.prototype.tag = function (tag, noFormat) {
this.currentTag.tag = tag;
this.currentTag.tagFormat = noFormat ? tag : this.formatTag(tag);
this.currentTag.noTag = false;
};
AbstractTags.prototype.notag = function () {
this.tag('', true);
this.currentTag.noTag = true;
};
Object.defineProperty(AbstractTags.prototype, "noTag", {
get: function () {
return this.currentTag.noTag;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AbstractTags.prototype, "label", {
get: function () {
return this.currentTag.labelId;
},
set: function (label) {
this.currentTag.labelId = label;
},
enumerable: false,
configurable: true
});
AbstractTags.prototype.formatUrl = function (id, base) {
return base + '#' + encodeURIComponent(id);
};
AbstractTags.prototype.formatTag = function (tag) {
return '(' + tag + ')';
};
AbstractTags.prototype.formatId = function (id) {
return 'mjx-eqn:' + id.replace(/\s/g, '_');
};
AbstractTags.prototype.formatNumber = function (n) {
return n.toString();
};
AbstractTags.prototype.autoTag = function () {
if (this.currentTag.tag == null) {
this.counter++;
this.tag(this.formatNumber(this.counter), false);
}
};
AbstractTags.prototype.clearTag = function () {
this.label = '';
this.tag(null, true);
this.currentTag.tagId = '';
};
AbstractTags.prototype.getTag = function (force) {
if (force === void 0) { force = false; }
if (force) {
this.autoTag();
return this.makeTag();
}
var ct = this.currentTag;
if (ct.taggable && !ct.noTag) {
if (ct.defaultTags) {
this.autoTag();
}
if (ct.tag) {
return this.makeTag();
}
}
return null;
};
AbstractTags.prototype.resetTag = function () {
this.history = [];
this.redo = false;
this.refUpdate = false;
this.clearTag();
};
AbstractTags.prototype.reset = function (offset) {
if (offset === void 0) { offset = 0; }
this.resetTag();
this.counter = this.allCounter = offset;
this.allLabels = {};
this.allIds = {};
};
AbstractTags.prototype.startEquation = function (math) {
this.history = [];
this.stack = [];
this.clearTag();
this.currentTag = new TagInfo('', undefined, undefined);
this.labels = {};
this.ids = {};
this.counter = this.allCounter;
this.redo = false;
var recompile = math.inputData.recompile;
if (recompile) {
this.refUpdate = true;
this.counter = recompile.counter;
}
};
AbstractTags.prototype.finishEquation = function (math) {
if (this.redo) {
math.inputData.recompile = {
state: math.state(),
counter: this.allCounter
};
}
if (!this.refUpdate) {
this.allCounter = this.counter;
}
Object.assign(this.allIds, this.ids);
Object.assign(this.allLabels, this.labels);
};
AbstractTags.prototype.finalize = function (node, env) {
if (!env.display || this.currentTag.env ||
this.currentTag.tag == null) {
return node;
}
var tag = this.makeTag();
var table = this.enTag(node, tag);
return table;
};
AbstractTags.prototype.makeId = function () {
this.currentTag.tagId = this.formatId(this.configuration.options['useLabelIds'] ?
(this.label || this.currentTag.tag) : this.currentTag.tag);
};
AbstractTags.prototype.makeTag = function () {
this.makeId();
if (this.label) {
this.labels[this.label] = new Label(this.currentTag.tag, this.currentTag.tagId);
}
var mml = new TexParser_js_1.default('\\text{' + this.currentTag.tagFormat + '}', {}, this.configuration).mml();
return this.configuration.nodeFactory.create('node', 'mtd', [mml], { id: this.currentTag.tagId });
};
return AbstractTags;
}());
exports.AbstractTags = AbstractTags;
var NoTags = (function (_super) {
__extends(NoTags, _super);
function NoTags() {
return _super !== null && _super.apply(this, arguments) || this;
}
NoTags.prototype.autoTag = function () { };
NoTags.prototype.getTag = function () {
return !this.currentTag.tag ? null : _super.prototype.getTag.call(this);
};
return NoTags;
}(AbstractTags));
exports.NoTags = NoTags;
var AllTags = (function (_super) {
__extends(AllTags, _super);
function AllTags() {
return _super !== null && _super.apply(this, arguments) || this;
}
AllTags.prototype.finalize = function (node, env) {
if (!env.display || this.history.find(function (x) { return x.taggable; })) {
return node;
}
var tag = this.getTag(true);
return this.enTag(node, tag);
};
return AllTags;
}(AbstractTags));
exports.AllTags = AllTags;
var TagsFactory;
(function (TagsFactory) {
var tagsMapping = new Map([
['none', NoTags],
['all', AllTags]
]);
var defaultTags = 'none';
TagsFactory.OPTIONS = {
tags: defaultTags,
tagSide: 'right',
tagIndent: '0.8em',
useLabelIds: true,
ignoreDuplicateLabels: false
};
TagsFactory.add = function (name, constr) {
tagsMapping.set(name, constr);
};
TagsFactory.addTags = function (tags) {
var e_1, _a;
try {
for (var _b = __values(Object.keys(tags)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
TagsFactory.add(key, tags[key]);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
TagsFactory.create = function (name) {
var constr = tagsMapping.get(name) || tagsMapping.get(defaultTags);
if (!constr) {
throw Error('Unknown tags class');
}
return new constr();
};
TagsFactory.setDefault = function (name) {
defaultTags = name;
};
TagsFactory.getDefault = function () {
return TagsFactory.create(defaultTags);
};
})(TagsFactory = exports.TagsFactory || (exports.TagsFactory = {}));
//# sourceMappingURL=Tags.js.map
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More