/*************************************************************
*
* MathJax/extensions/mml2jax.js
*
* Implements the MathML to Jax preprocessor that locates )
if (node.outerHTML != null && node.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)) {
for (i = 0, m = node.childNodes.length; i < m; i++)
{html += this.OuterHTML(node.childNodes[i])}
html += ""+node.nodeName.toLowerCase()+">";
}
}
return html;
},
OuterHTML: function (node) {
if (node.nodeName.charAt(0) === "#") {return this.NodeHTML(node)}
if (!this.AttributeBug) {return node.outerHTML}
var html = this.NodeHTML(node);
for (var i = 0, m = node.childNodes.length; i < m; i++)
{html += this.OuterHTML(node.childNodes[i]);}
html += ""+node.nodeName.toLowerCase()+">";
return html;
},
quoteHTML: function (string) {
if (string == null) {string = ""}
return string.replace(/&/g,"&").replace(//g,">").replace(/"/g,""");
},
createPreview: function (math,script) {
var preview;
if (this.config.preview === "alttext") {
var text = math.getAttribute("alttext");
if (text != null) {preview = [this.filterText(text)]}
} else if (this.config.preview instanceof Array) {preview = this.config.preview}
if (preview) {
preview = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
script.parentNode.insertBefore(preview,script);
}
},
filterText: function (text) {return text},
InitBrowser: function () {
var test = MathJax.HTML.Element("span",{id:"<", className: "mathjax", innerHTML: "x"});
var html = test.outerHTML || "";
this.AttributeBug = html !== "" && !(
html.match(/id="<"/) && // "<" should convert to "<"
html.match(/class="mathjax"/) && // IE leaves out quotes
html.match(/<\/math>/) // Opera 9 drops tags after self-closing tags
);
this.MathTagBug = test.childNodes.length > 1; // IE < 9 flattens unknown tags
this.CleanupHTML = MathJax.Hub.Browser.isMSIE; // remove namespace and other added tags
}
};
MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);
MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");