diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js index e26ea89c4..e8e018912 100644 --- a/unpacked/extensions/toMathML.js +++ b/unpacked/extensions/toMathML.js @@ -38,10 +38,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () { if (space == null) {space = ""} var tag = this.type, attr = this.toMathMLattributes(); if (tag === "mspace") {return space + "<"+tag+attr+" />"} - var data = []; var SPACE = (this.isToken ? "" : space+(inferred ? "" : " ")); + var data = [], SPACE = (this.isToken ? "" : space+(inferred ? "" : " ")); for (var i = 0, m = this.data.length; i < m; i++) { if (this.data[i]) {data.push(this.data[i].toMathML(SPACE))} - else if (!this.isToken) {data.push(SPACE+"")} + else if (!this.isToken && !this.isChars) {data.push(SPACE+"")} } if (this.isToken) {return space + "<"+tag+attr+">"+data.join("")+""} if (inferred) {return data.join("\n")} diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index 713db61a3..e24fd3339 100644 --- a/unpacked/jax/element/mml/jax.js +++ b/unpacked/jax/element/mml/jax.js @@ -275,7 +275,7 @@ MathJax.ElementJax.mml.Augment({ SetData: function (i,item) { if (item != null) { if (!(item instanceof MML.mbase)) - {item = (this.isToken ? MML.chars(item) : MML.mtext(item))} + {item = (this.isToken || this.isChars ? MML.chars(item) : MML.mtext(item))} item.parent = this; item.setInherit(this.inheritFromMe ? this : this.inherit); } @@ -1247,7 +1247,7 @@ MathJax.ElementJax.mml.Augment({ } }); MML.annotation = MML.mbase.Subclass({ - type: "annotation", isToken: true, + type: "annotation", isChars: true, linebreakContainer: true, defaults: { definitionURL: null, diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index 22b2f53da..46515c6a0 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -157,7 +157,7 @@ var child = node.childNodes[i]; if (child.nodeName === "#comment") continue; if (child.nodeName === "#text") { - if (mml.isToken && !mml.mmlSelfClosing) { + if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) { var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); mml.Append(MML.chars(this.trimSpace(text))); } else if (child.nodeValue.match(/\S/)) {