Merge branch 'issue912' into develop. Issue #912.

This commit is contained in:
Davide P. Cervone 2014-10-12 16:59:12 -04:00
commit c1a457ff9e
2 changed files with 12 additions and 8 deletions

View File

@ -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 ""}

View File

@ -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",