Merge branch 'DOMfilterHooks' into develop
This commit is contained in:
commit
8726bd52a5
|
@ -36,12 +36,12 @@
|
||||||
|
|
||||||
MATHML.Parse = MathJax.Object.Subclass({
|
MATHML.Parse = MathJax.Object.Subclass({
|
||||||
|
|
||||||
Init: function (string) {this.Parse(string)},
|
Init: function (string,script) {this.Parse(string,script)},
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse the MathML and check for errors
|
// Parse the MathML and check for errors
|
||||||
//
|
//
|
||||||
Parse: function (math) {
|
Parse: function (math,script) {
|
||||||
var doc;
|
var doc;
|
||||||
if (typeof math !== "string") {doc = math.parentNode} else {
|
if (typeof math !== "string") {doc = math.parentNode} else {
|
||||||
doc = MATHML.ParseXML(this.preProcessMath.call(this,math));
|
doc = MATHML.ParseXML(this.preProcessMath.call(this,math));
|
||||||
|
@ -63,7 +63,9 @@
|
||||||
"MathML must be formed by a <math> element, not %1",
|
"MathML must be formed by a <math> element, not %1",
|
||||||
"<"+doc.firstChild.nodeName+">"]);
|
"<"+doc.firstChild.nodeName+">"]);
|
||||||
}
|
}
|
||||||
this.mml = this.MakeMML(doc.firstChild);
|
var data = {math:doc.firstChild, script:script};
|
||||||
|
MATHML.DOMfilterHooks.Execute(data);
|
||||||
|
this.mml = this.MakeMML(data.math);
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -242,8 +244,9 @@
|
||||||
MATHML.Augment({
|
MATHML.Augment({
|
||||||
sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"],
|
sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"],
|
||||||
|
|
||||||
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing MathML
|
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML string before processing MathML
|
||||||
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing MathML
|
DOMfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML DOM before processing
|
||||||
|
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on internal jax format after processing MathML
|
||||||
|
|
||||||
Translate: function (script) {
|
Translate: function (script) {
|
||||||
if (!this.ParseXML) {this.ParseXML = this.createParser()}
|
if (!this.ParseXML) {this.ParseXML = this.createParser()}
|
||||||
|
@ -258,7 +261,7 @@
|
||||||
data.math = math; this.prefilterHooks.Execute(data); math = data.math;
|
data.math = math; this.prefilterHooks.Execute(data); math = data.math;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mml = MATHML.Parse(math).mml;
|
mml = MATHML.Parse(math,script).mml;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
if (!err.mathmlError) {throw err}
|
if (!err.mathmlError) {throw err}
|
||||||
mml = this.formatError(err,math,script);
|
mml = this.formatError(err,math,script);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user