From 0928aac88e31d4b5703e8de7db41705c6cc6f97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Thu, 28 Feb 2013 11:56:27 +0100 Subject: [PATCH 1/5] Experimental content-mathml extension. --- unpacked/extensions/MathML/content-mathml.js | 59 ++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 unpacked/extensions/MathML/content-mathml.js diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js new file mode 100644 index 000000000..d0dbe9d7e --- /dev/null +++ b/unpacked/extensions/MathML/content-mathml.js @@ -0,0 +1,59 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/************************************************************* + * + * MathJax/extensions/MathML/content-mathml.js + * + * This extension allows HTML-CSS output to deal with floating elements + * better. In particular, when there are tags or equation numbers, these + * would overlap floating elements, but with this extension, the width of + * the line should properly correspond to the amount of space remaining. + * + * To load it, include + * + * MathML: { + * extensions: ["content-mathml.js"] + * } + * + * in your configuration. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013 Design Science, Inc. + * + * 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.Extension["MathML/content-mathml"] = { + version: "2.2" +}; + +MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { + + MathJax.InputJax.MathML.prefilterHooks.Add(function (data) { + var doc = MathJax.InputJax.MathML.ParseXML(data.math); + var newMath = MathJax.InputJax.MathML.ctopXSLT. + transformToFragment(doc.documentElement, doc); + var serializer = new XMLSerializer(); + data.math = serializer.serializeToString(newMath, doc); + }); + + var ctopStylesheet = new DOMParser().parseFromString(' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) ', "text/xml"); + MathJax.InputJax.MathML.ctopXSLT = new XSLTProcessor(); + MathJax.InputJax.MathML.ctopXSLT.importStylesheet(ctopStylesheet); + + MathJax.Hub.Startup.signal.Post("MathML content-mathml Ready"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/MathML/content-mathml.js"); From ca718359ccdf12e510473f969b8ecd2894b621a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Tue, 5 Mar 2013 12:30:48 +0100 Subject: [PATCH 2/5] Handle parsing of the source better. --- unpacked/extensions/MathML/content-mathml.js | 26 ++++++++++---- unpacked/jax/input/MathML/jax.js | 38 +++++++++++++------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js index d0dbe9d7e..11560a86f 100644 --- a/unpacked/extensions/MathML/content-mathml.js +++ b/unpacked/extensions/MathML/content-mathml.js @@ -41,17 +41,31 @@ MathJax.Extension["MathML/content-mathml"] = { MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { - MathJax.InputJax.MathML.prefilterHooks.Add(function (data) { - var doc = MathJax.InputJax.MathML.ParseXML(data.math); + var MATHML = MathJax.InputJax.MathML; + + MATHML.prefilterHooks.Add(function (data) { + // Parse the MathML source but add a dummy root to handle the HTML5 case + // where the MathML namespace may not be specified on the element. + var doc = MathJax.InputJax.MathML.ParseXML( + "" + + MATHML.Parse(data.math, true) + + ""); + + // Now transform the using the ctop stylesheet. var newMath = MathJax.InputJax.MathML.ctopXSLT. - transformToFragment(doc.documentElement, doc); + transformToFragment(doc.documentElement.firstChild, doc); + + // Serialize the again. var serializer = new XMLSerializer(); data.math = serializer.serializeToString(newMath, doc); }); - var ctopStylesheet = new DOMParser().parseFromString(' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) ', "text/xml"); - MathJax.InputJax.MathML.ctopXSLT = new XSLTProcessor(); - MathJax.InputJax.MathML.ctopXSLT.importStylesheet(ctopStylesheet); + if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} + var ctopStylesheet = MathJax.InputJax.MathML.ParseXML(' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) ', "text/xml"); + if (window.XSLTProcessor) { + MATHML.ctopXSLT = new XSLTProcessor(); + MATHML.ctopXSLT.importStylesheet(ctopStylesheet); + } MathJax.Hub.Startup.signal.Post("MathML content-mathml Ready"); }); diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index 1270eefb7..b19180da8 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/input/MathML/jax.js @@ -28,7 +30,12 @@ MATHML.Parse = MathJax.Object.Subclass({ - Init: function (string) {this.Parse(string)}, + Init: function (string, cleanUpOnly) { + if (cleanUpOnly) { + return this.cleanUpMath.call(this,string); + } + this.Parse(string); + }, // // Parse the MathML and check for errors @@ -36,17 +43,8 @@ Parse: function (math) { var doc; if (typeof math !== "string") {doc = math.parentNode} else { - if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) - {math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"')} - // HTML5 removes xmlns: namespaces, so put them back for XML - var match = math.match(/^(])+)>)/i); - if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { - math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + - math.substr(match[0].length); - } - math = math.replace(/^\s*(?:\/\/)?\s*$/,"$2"); - math = math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); - doc = MATHML.ParseXML(math); if (doc == null) {MATHML.Error("Error parsing MathML")} + doc = MATHML.ParseXML(this.cleanUpMath.call(this,math)); + if (doc == null) {MATHML.Error("Error parsing MathML")} } var err = doc.getElementsByTagName("parsererror")[0]; if (err) MATHML.Error("Error parsing MathML: "+err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")); @@ -160,6 +158,22 @@ } }, + // + // Clean Up the source to prepare for XML parsing + // + cleanUpMath: function (math) { + if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) { + math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"') + } + // HTML5 removes xmlns: namespaces, so put them back for XML + var match = math.match(/^(])+)>)/i); + if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { + math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + math.substr(match[0].length); + } + math = math.replace(/^\s*(?:\/\/)?\s*$/,"$2"); + return math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + }, + // // Remove attribute whitespace // From 276b7751dc8262adeb5104eea760782557719fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Tue, 5 Mar 2013 15:15:45 +0100 Subject: [PATCH 3/5] Implement the XSLT for IE <= 8. --- unpacked/extensions/MathML/content-mathml.js | 40 +++++++++++++------- unpacked/jax/input/MathML/jax.js | 31 ++++++++++----- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js index 11560a86f..ed45f8ac0 100644 --- a/unpacked/extensions/MathML/content-mathml.js +++ b/unpacked/extensions/MathML/content-mathml.js @@ -44,27 +44,41 @@ MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { var MATHML = MathJax.InputJax.MathML; MATHML.prefilterHooks.Add(function (data) { - // Parse the MathML source but add a dummy root to handle the HTML5 case - // where the MathML namespace may not be specified on the element. - var doc = MathJax.InputJax.MathML.ParseXML( - "" + - MATHML.Parse(data.math, true) + - ""); + // Parse the but use MATHML.Parse to apply the normal preprocessing. + if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} + var doc = MathJax.InputJax.MathML.ParseXML(MATHML.Parse(data.math, true)); // Now transform the using the ctop stylesheet. - var newMath = MathJax.InputJax.MathML.ctopXSLT. - transformToFragment(doc.documentElement.firstChild, doc); + var newdoc = MathJax.InputJax.MathML. + ctopXSLT.transformToDocument(doc.documentElement); // Serialize the again. - var serializer = new XMLSerializer(); - data.math = serializer.serializeToString(newMath, doc); + if (window.XMLSerializer) { + var serializer = new XMLSerializer(); + data.math = serializer.serializeToString(newdoc.documentElement, doc); + } else { + data.math = newdoc.toString(); + } }); - if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} - var ctopStylesheet = MathJax.InputJax.MathML.ParseXML(' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) ', "text/xml"); + var ctopStylesheet = ' +i +i / / ei ei E 0x . (-1) λ. id domain codomain image unexpected domainofapplication restriction {   if     otherwise / ! / max min (+) mod (×) gcd xor ¬ . . , || ¯ arg lcm = > < | d dddd D, + + , div div() grad grad() curl 2 () || × = lim lim tendsto e loglog , σ σ2 median mode () [|] [|] () () [m , | m , =;] () det || T , . Z R Q N C P e i NaN true false π γ () () ||, share ) ( ] [ } { ) ( ] [ } { \ )(}{>< top right ;color:;background-color:; 0 decimalpoint decimalpoint. decimalpoint*0.1em0.15em0.2em0.15em 0 /\)(:=) '; if (window.XSLTProcessor) { + // standard method: just use an XSLTProcessor and parse the stylesheet + if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} MATHML.ctopXSLT = new XSLTProcessor(); - MATHML.ctopXSLT.importStylesheet(ctopStylesheet); + MATHML.ctopXSLT.importStylesheet(MATHML.ParseXML(ctopStylesheet)); + } else { + // Internet Explorer <= 8: use transformNode + if (!MATHML.ParseXSLT) { + MATHML.ParseXSLT = MATHML.createMSParser(); + MATHML.ParseXSLT.async = false; + MATHML.ParseXSLT.loadXML(ctopStylesheet); + } + MATHML.ctopXSLT = { + transformToDocument: function(node) { + return node.transformNode(MATHML.ParseXSLT); + } + } } MathJax.Hub.Startup.signal.Post("MathML content-mathml Ready"); diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index b19180da8..7f7e6ea5a 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -30,9 +30,9 @@ MATHML.Parse = MathJax.Object.Subclass({ - Init: function (string, cleanUpOnly) { - if (cleanUpOnly) { - return this.cleanUpMath.call(this,string); + Init: function (string, preProcessMathOnly) { + if (preProcessMathOnly) { + return this.preProcessMath.call(this,string); } this.Parse(string); }, @@ -43,7 +43,7 @@ Parse: function (math) { var doc; if (typeof math !== "string") {doc = math.parentNode} else { - doc = MATHML.ParseXML(this.cleanUpMath.call(this,math)); + doc = MATHML.ParseXML(this.preProcessMath.call(this,math)); if (doc == null) {MATHML.Error("Error parsing MathML")} } var err = doc.getElementsByTagName("parsererror")[0]; @@ -161,7 +161,7 @@ // // Clean Up the source to prepare for XML parsing // - cleanUpMath: function (math) { + preProcessMath: function (math) { if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) { math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"') } @@ -170,6 +170,10 @@ if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + math.substr(match[0].length); } + if (math.match(/^]* xmlns=/)) { + // append the MathML namespace + math = math.replace(/^<(math)/i,'\s*$/,"$2"); return math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); }, @@ -253,6 +257,18 @@ return this.div; }, parseError: function (string) {return null}, + createMSParser: function() { + var parser = null; + var xml = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0", + "MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0", + "MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"]; + for (var i = 0, m = xml.length; i < m && !parser; i++) { + try { + parser = new ActiveXObject(xml[i]) + } catch (err) {} + } + return parser; + }, // // Create the parser using a DOMParser, or other fallback method // @@ -261,10 +277,7 @@ this.parser = new DOMParser(); return(this.parseDOM); } else if (window.ActiveXObject) { - var xml = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0", - "MSXML2.DOMDocument.3.0","MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"]; - for (var i = 0, m = xml.length; i < m && !this.parser; i++) - {try {this.parser = new ActiveXObject(xml[i])} catch (err) {}} + this.parser = this.createMSParser(); if (!this.parser) { alert("MathJax can't create an XML parser for MathML. Check that\n"+ "the 'Script ActiveX controls marked safe for scripting' security\n"+ From 842dc53c3600a2c1da16abfe53baf8b85e9d6ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Wed, 6 Mar 2013 12:09:07 +0100 Subject: [PATCH 4/5] Try to implement the XSLT transform for IE>=9. --- unpacked/extensions/MathML/content-mathml.js | 55 ++++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js index ed45f8ac0..b2c17fe73 100644 --- a/unpacked/extensions/MathML/content-mathml.js +++ b/unpacked/extensions/MathML/content-mathml.js @@ -44,20 +44,23 @@ MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { var MATHML = MathJax.InputJax.MathML; MATHML.prefilterHooks.Add(function (data) { + if (!MATHML.ctopXSLT) return; + // Parse the but use MATHML.Parse to apply the normal preprocessing. if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} var doc = MathJax.InputJax.MathML.ParseXML(MATHML.Parse(data.math, true)); // Now transform the using the ctop stylesheet. - var newdoc = MathJax.InputJax.MathML. - ctopXSLT.transformToDocument(doc.documentElement); + var newdoc = MathJax.InputJax.MathML.ctopXSLT.transformToDocument(doc); - // Serialize the again. - if (window.XMLSerializer) { + if ((typeof newdoc) === "string") { + // Internet Explorer returns a string, so just use it. + data.math = newdoc; + } else if (window.XMLSerializer) { + // Serialize the again. We could directly provide the DOM content + // but other prefilterHooks may assume data.math is still a string. var serializer = new XMLSerializer(); data.math = serializer.serializeToString(newdoc.documentElement, doc); - } else { - data.math = newdoc.toString(); } }); @@ -67,18 +70,38 @@ MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} MATHML.ctopXSLT = new XSLTProcessor(); MATHML.ctopXSLT.importStylesheet(MATHML.ParseXML(ctopStylesheet)); - } else { - // Internet Explorer <= 8: use transformNode - if (!MATHML.ParseXSLT) { - MATHML.ParseXSLT = MATHML.createMSParser(); - MATHML.ParseXSLT.async = false; - MATHML.ParseXSLT.loadXML(ctopStylesheet); - } - MATHML.ctopXSLT = { - transformToDocument: function(node) { - return node.transformNode(MATHML.ParseXSLT); + } else if (MathJax.Hub.Browser.isMSIE) { + // nonstandard methods for Internet Explorer + if (MathJax.Hub.Browser.versionAtLeast("9.0")) { + // For Internet Explorer >= 9, use createProcessor + var ctop = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); + ctop.loadXML(ctopStylesheet); + var xslt = new ActiveXObject("Msxml2.XSLTemplate"); + xslt.stylesheet = ctop; + MATHML.ctopXSLT = { + ctop: xslt.createProcessor(), + transformToDocument: function(doc) { + this.ctop.input = doc; + this.ctop.transform(); + return this.ctop.output; + } + } + } else { + // For Internet Explorer <= 8, use transformNode + var ctop = MATHML.createMSParser(); + ctop.async = false; + ctop.loadXML(ctopStylesheet); + + MATHML.ctopXSLT = { + ctop: ctop, + transformToDocument: function(doc) { + return doc.documentElement.transformNode(this.ctop); + } } } + } else { + // No XSLT support. Do not change the content. + MATHML.ctopXSLT = null; } MathJax.Hub.Startup.signal.Post("MathML content-mathml Ready"); From 2d33f1d34836bb722f50d8b5b7ff1ecade41814d Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 22 Apr 2013 15:44:58 -0400 Subject: [PATCH 5/5] Call MATML.Parse.prototype directly rather than make a special flag for preprocessing. Use MATHML variable rather than full reference. --- unpacked/extensions/MathML/content-mathml.js | 20 +++++++++++--------- unpacked/jax/input/MathML/jax.js | 7 +------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/unpacked/extensions/MathML/content-mathml.js b/unpacked/extensions/MathML/content-mathml.js index b2c17fe73..76a973921 100644 --- a/unpacked/extensions/MathML/content-mathml.js +++ b/unpacked/extensions/MathML/content-mathml.js @@ -1,13 +1,15 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/MathML/content-mathml.js * - * This extension allows HTML-CSS output to deal with floating elements - * better. In particular, when there are tags or equation numbers, these - * would overlap floating elements, but with this extension, the width of - * the line should properly correspond to the amount of space remaining. + * This file implements an XSLT transform to convert Content-MathML to + * Presentation MathML for processing by MathJax. The transform is + * performed in a pre-filter for the MathML input jax, so that the + * Show Math As menu will still show the Original MathML as Content MathML, + * but the Presentation MathML can be obtained from the main MathML menu. * * To load it, include * @@ -39,19 +41,20 @@ MathJax.Extension["MathML/content-mathml"] = { version: "2.2" }; -MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { +MathJax.Hub.Register.StartupHook("MathML Jax Ready",function () { - var MATHML = MathJax.InputJax.MathML; + var MATHML = MathJax.InputJax.MathML, + PARSE = MATHML.Parse.prototype; MATHML.prefilterHooks.Add(function (data) { if (!MATHML.ctopXSLT) return; // Parse the but use MATHML.Parse to apply the normal preprocessing. if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} - var doc = MathJax.InputJax.MathML.ParseXML(MATHML.Parse(data.math, true)); + var doc = MATHML.ParseXML(PARSE.preProcessMath(data.math)); // Now transform the using the ctop stylesheet. - var newdoc = MathJax.InputJax.MathML.ctopXSLT.transformToDocument(doc); + var newdoc = MATHML.ctopXSLT.transformToDocument(doc); if ((typeof newdoc) === "string") { // Internet Explorer returns a string, so just use it. @@ -91,7 +94,6 @@ MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { var ctop = MATHML.createMSParser(); ctop.async = false; ctop.loadXML(ctopStylesheet); - MATHML.ctopXSLT = { ctop: ctop, transformToDocument: function(doc) { diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index 7f7e6ea5a..b0a0c908a 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -30,12 +30,7 @@ MATHML.Parse = MathJax.Object.Subclass({ - Init: function (string, preProcessMathOnly) { - if (preProcessMathOnly) { - return this.preProcessMath.call(this,string); - } - this.Parse(string); - }, + Init: function (string) {this.Parse(string)}, // // Parse the MathML and check for errors