Fix problem with " in attributes, and with entity names that include numbers
This commit is contained in:
parent
3687469e6f
commit
b7525afe5c
|
@ -12,5 +12,5 @@
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"1.1.2",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.3",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({
|
MathJax.InputJax.MathML = MathJax.InputJax({
|
||||||
id: "MathML",
|
id: "MathML",
|
||||||
version: "1.1.2",
|
version: "1.1.3",
|
||||||
directory: MathJax.InputJax.directory + "/MathML",
|
directory: MathJax.InputJax.directory + "/MathML",
|
||||||
extensionDir: MathJax.InputJax.extensionDir + "/MathML",
|
extensionDir: MathJax.InputJax.extensionDir + "/MathML",
|
||||||
entityDir: MathJax.InputJax.directory + "/MathML/entities",
|
entityDir: MathJax.InputJax.directory + "/MathML/entities",
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/))
|
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"')}
|
{math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"')}
|
||||||
math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2");
|
math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2");
|
||||||
math = math.replace(/&([a-z]+);/ig,this.replaceEntity);
|
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(math); if (doc == null) {MATHML.Error("Error parsing MathML")}
|
||||||
}
|
}
|
||||||
var err = doc.getElementsByTagName("parsererror")[0];
|
var err = doc.getElementsByTagName("parsererror")[0];
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
var text = this.trimSpace(child.nodeValue);
|
var text = this.trimSpace(child.nodeValue);
|
||||||
if (mml.isa(MML.mo) && text.length === 1 && this.Remap[text.charAt(0)])
|
if (mml.isa(MML.mo) && text.length === 1 && this.Remap[text.charAt(0)])
|
||||||
{text = this.Remap[text.charAt(0)]}
|
{text = this.Remap[text.charAt(0)]}
|
||||||
text = text.replace(/&([a-z]+);/ig,this.replaceEntity);
|
text = text.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
|
||||||
mml.Append(MML.chars(text));
|
mml.Append(MML.chars(text));
|
||||||
} else if (child.nodeValue.match(/\S/)) {
|
} else if (child.nodeValue.match(/\S/)) {
|
||||||
MATHML.Error("Unexpected text node: '"+child.nodeValue+"'");
|
MATHML.Error("Unexpected text node: '"+child.nodeValue+"'");
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
replaceEntity: function (match,entity) {
|
replaceEntity: function (match,entity) {
|
||||||
if (entity === "lt" || entity === "amp") {return match}
|
if (entity.match(/^(lt|amp|quot)$/)) {return match} // these mess up attribute parsing
|
||||||
if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]}
|
if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]}
|
||||||
var file = entity.charAt(0).toLowerCase();
|
var file = entity.charAt(0).toLowerCase();
|
||||||
var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/);
|
var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user