Address review comments #627

This commit is contained in:
Frédéric Wang 2013-10-21 10:04:39 +02:00
parent f76182da27
commit 3fee31b7e4
7 changed files with 23 additions and 22 deletions

View File

@ -223,7 +223,19 @@ MathJax.ElementJax.mml.Augment({
"fontfamily", "fontsize", "fontweight", "fontstyle",
"color", "background",
"id", "class", "href", "style"
]
],
Error: function (message,def) {
var mml = this.merror(message),
dir = MathJax.Localization.fontDirection(),
font = MathJax.Localization.fontFamily();
if (def) {mml = mml.With(def)}
if (dir || font) {
mml = this.mstyle(mml);
if (dir) {mml.dir = dir}
if (font) {mml.style.fontFamily = "font-family: "+font}
}
return mml;
}
});
(function (MML) {

View File

@ -1292,8 +1292,7 @@ junk = null;
formatError: function (err,math,script) {
var message = err.message.replace(/\n.*/,"");
MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",message,math,script]);
var mml = MML.merror(message);
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
return MML.Error(message);
},
Error: function (message) {
throw MathJax.Hub.Insert(Error(message),{asciimathError: true});

View File

@ -77,9 +77,7 @@
mml = this.TeXAtom(match[2]);
} else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) {
MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]);
var err = MML.merror(_("UnknownNodeType","Unknown node type: %1",type));
if (MathJax.Localization.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
return err;
return MML.Error(_("UnknownNodeType","Unknown node type: %1",type));
} else {
mml = MML[type]();
}
@ -269,8 +267,7 @@
formatError: function (err,math,script) {
var message = err.message.replace(/\n.*/,"");
MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]);
var mml = MML.merror(message);
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
return MML.Error(message);
},
Error: function (message) {
//

View File

@ -2099,8 +2099,7 @@
formatError: function (err,math,display,script) {
var message = err.message.replace(/\n.*/,"");
HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]);
var mml = MML.merror(message);
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
return MML.Error(message);
},
//

View File

@ -45,8 +45,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
} else {
if (values.alt === "")
{values.alt = LOCALE._(["MathML","BadMglyphFont"],"Bad font: %1",font.family)}
err = MML.merror(values.alt).With({mathsize:"75%"});
if (LOCALE.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
err = MML.Error(values.alt).With({mathsize:"75%"});
this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox;
}
@ -63,10 +62,9 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
MathJax.Hub.RestartAfter(img.onload);
}
if (this.img.status !== "OK") {
err = MML.merror(
err = MML.Error(
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
).With({mathsize:"75%"});
if (LOCALE.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox;
} else {

View File

@ -1724,8 +1724,9 @@
},
HTMLhandleDir: function (span) {
span.style.direction = this.Get("dir");
return span;
var dir = this.Get("dir",true); // only get value if not the default
if (dir) {span.dir = dir}
return span;
},
HTMLhandleColor: function (span) {
@ -2305,7 +2306,6 @@
}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
this.HTMLhandleDir(span);
return span;
},
HTMLstretchH: MML.mbase.HTMLstretchH,
@ -2699,10 +2699,6 @@
// Add color (if any)
//
this.HTMLhandleColor(span);
//
// Add direction (if any)
//
this.HTMLhandleDir(span);
//
// Make math span be the correct height and depth
//

View File

@ -74,7 +74,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
MathJax.Hub.RestartAfter(img.onload);
}
if (this.img.status !== "OK") {
err = MML.merror(
err = MML.Error(
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
).With({mathsize:"75%"});
this.Append(err); svg = err.toSVG(); this.data.pop();