Work around HTML5 removing namespaces, so that xmlns:xlink becomes xlink with no namespace, which confuses the XML parsers.
This commit is contained in:
parent
da8d4885fb
commit
7f6c93b1c9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"1.1.4",directory:MathJax.InputJax.directory+"/MathML",extensionDir:MathJax.InputJax.extensionDir+"/MathML",entityDir:MathJax.InputJax.directory+"/MathML/entities",config:{useMathMLspacing:false}});MathJax.InputJax.MathML.Register("math/mml");MathJax.InputJax.MathML.loadComplete("config.js");
|
||||
MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"1.1.5",directory:MathJax.InputJax.directory+"/MathML",extensionDir:MathJax.InputJax.extensionDir+"/MathML",entityDir:MathJax.InputJax.directory+"/MathML/entities",config:{useMathMLspacing:false}});MathJax.InputJax.MathML.Register("math/mml");MathJax.InputJax.MathML.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.InputJax.MathML = MathJax.InputJax({
|
||||
id: "MathML",
|
||||
version: "1.1.4",
|
||||
version: "1.1.5",
|
||||
directory: MathJax.InputJax.directory + "/MathML",
|
||||
extensionDir: MathJax.InputJax.extensionDir + "/MathML",
|
||||
entityDir: MathJax.InputJax.directory + "/MathML/entities",
|
||||
|
|
|
@ -38,6 +38,12 @@
|
|||
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(/^(<math( ('[^']*'|"[^"]"|[^>])+)>)/i);
|
||||
if (match && match[2].replace(/ xmlns=".*?"/,"").match(/ [a-z]+=\"http:/i)) {
|
||||
math = match[1].replace(/ ([a-z]+)=("http:.*?")/ig,this.replaceXMLNS) +
|
||||
math.substr(match[0].length);
|
||||
}
|
||||
math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\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")}
|
||||
|
@ -103,6 +109,11 @@
|
|||
.replace(/[ \t\n\r][ \t\n\r]+/g," "); // internal multiple whitespace
|
||||
},
|
||||
|
||||
replaceXMLNS: function (match,name,value) {
|
||||
if (name === "xmlns") {return " " + name + "=" + value}
|
||||
return " xmlns:"+name+"="+value + " " + name+"="+value;
|
||||
},
|
||||
|
||||
replaceEntity: function (match,entity) {
|
||||
if (entity.match(/^(lt|amp|quot)$/)) {return match} // these mess up attribute parsing
|
||||
if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]}
|
||||
|
|
Loading…
Reference in New Issue
Block a user