commit c1a457ff9ebc6730e83ba21e390186812bb25904
parent 01bec60e5a5f2a48ff1c8b03ff04963d246188cf
Author: Davide P. Cervone <dpvc@union.edu>
Date: Sun, 12 Oct 2014 16:59:12 -0400
Merge branch 'issue912' into develop. Issue #912.
Diffstat:
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js
@@ -52,13 +52,14 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
toMathMLattributes: function () {
var attr = [], defaults = this.defaults;
- var copy = (this.attrNames||MML.copyAttributeNames), skip = MML.skipAttributes;
+ var names = (this.attrNames||MML.copyAttributeNames),
+ skip = MML.skipAttributes, copy = MML.copyAttributes;
if (this.type === "math" && (!this.attr || !this.attr.xmlns))
{attr.push('xmlns="http://www.w3.org/1998/Math/MathML"')}
if (!this.attrNames) {
if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
- for (var id in defaults) {if (!skip[id] && defaults.hasOwnProperty(id)) {
+ for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
if (this[id] != null && this[id] !== defaults[id]) {
var value = this[id]; delete this[id];
if (this.Get(id) !== value) {attr.push(id+'="'+this.toMathMLattribute(value)+'"')}
@@ -66,10 +67,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
}
}}
}
- for (var i = 0, m = copy.length; i < m; i++) {
- if (copy[i] === "class") continue; // this is handled separately below
- value = (this.attr||{})[copy[i]]; if (value == null) {value = this[copy[i]]}
- if (value != null) {attr.push(copy[i]+'="'+this.toMathMLquote(value)+'"')}
+ for (var i = 0, m = names.length; i < m; i++) {
+ if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
+ value = (this.attr||{})[names[i]]; if (value == null) {value = this[names[i]]}
+ if (value != null) {attr.push(names[i]+'="'+this.toMathMLquote(value)+'"')}
}
this.toMathMLclass(attr);
if (attr.length) {return " "+attr.join(" ")} else {return ""}
diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js
@@ -214,12 +214,15 @@ MathJax.ElementJax.mml.Augment({
NONE: -1
},
TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", "INNER", "VCENTER"],
+ skipAttributes: {
+ texClass:true, useHeight:true, texprimestyle:true
+ },
copyAttributes: {
+ displaystyle:1, scriptlevel:1, open:1, close:1, form:1,
fontfamily:true, fontsize:true, fontweight:true, fontstyle:true,
color:true, background:true,
- id:true, "class":true, href:true, style:true
+ id:true, "class":1, href:true, style:true
},
- skipAttributes: {texClass: true, useHeight: true, texprimestyle: true},
copyAttributeNames: [
"displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied
"fontfamily", "fontsize", "fontweight", "fontstyle",