Fix problem with " in attributes, and with entity names that include numbers

This commit is contained in:
Davide P. Cervone 2011-06-01 18:17:52 -04:00
parent 3687469e6f
commit b7525afe5c
4 changed files with 6 additions and 6 deletions

View File

@ -12,5 +12,5 @@
* 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

View File

@ -24,7 +24,7 @@
MathJax.InputJax.MathML = MathJax.InputJax({
id: "MathML",
version: "1.1.2",
version: "1.1.3",
directory: MathJax.InputJax.directory + "/MathML",
extensionDir: MathJax.InputJax.extensionDir + "/MathML",
entityDir: MathJax.InputJax.directory + "/MathML/entities",

View File

@ -39,7 +39,7 @@
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(/^\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")}
}
var err = doc.getElementsByTagName("parsererror")[0];
@ -80,7 +80,7 @@
var text = this.trimSpace(child.nodeValue);
if (mml.isa(MML.mo) && text.length === 1 && 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));
} else if (child.nodeValue.match(/\S/)) {
MATHML.Error("Unexpected text node: '"+child.nodeValue+"'");
@ -104,7 +104,7 @@
},
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]}
var file = entity.charAt(0).toLowerCase();
var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/);