commit f38dc200fc7c2cf9a4f473171b11e16058caf40c
parent 0b3454ce25eace2785d933baa2aeef8d2379b340
Author: Davide P. Cervone <dpvc@union.edu>
Date: Thu, 20 Feb 2014 15:38:14 -0500
Make annotation NOT be a token element, by adding a new isChars flag to force its contents to be a chars node rather than an mtext node (which is why it was labelled isToken originally). Resolves issue #376.
Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git 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+"<mrow />")}
+ else if (!this.isToken && !this.isChars) {data.push(SPACE+"<mrow />")}
}
if (this.isToken) {return space + "<"+tag+attr+">"+data.join("")+"</"+tag+">"}
if (inferred) {return data.join("\n")}
diff --git 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
@@ -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/)) {