Address review comments #627
This commit is contained in:
parent
f76182da27
commit
3fee31b7e4
|
@ -223,7 +223,19 @@ MathJax.ElementJax.mml.Augment({
|
||||||
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
||||||
"color", "background",
|
"color", "background",
|
||||||
"id", "class", "href", "style"
|
"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) {
|
(function (MML) {
|
||||||
|
|
|
@ -1292,8 +1292,7 @@ junk = null;
|
||||||
formatError: function (err,math,script) {
|
formatError: function (err,math,script) {
|
||||||
var message = err.message.replace(/\n.*/,"");
|
var message = err.message.replace(/\n.*/,"");
|
||||||
MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",message,math,script]);
|
MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",message,math,script]);
|
||||||
var mml = MML.merror(message);
|
return MML.Error(message);
|
||||||
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
|
|
||||||
},
|
},
|
||||||
Error: function (message) {
|
Error: function (message) {
|
||||||
throw MathJax.Hub.Insert(Error(message),{asciimathError: true});
|
throw MathJax.Hub.Insert(Error(message),{asciimathError: true});
|
||||||
|
|
|
@ -77,9 +77,7 @@
|
||||||
mml = this.TeXAtom(match[2]);
|
mml = this.TeXAtom(match[2]);
|
||||||
} else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) {
|
} else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) {
|
||||||
MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]);
|
MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]);
|
||||||
var err = MML.merror(_("UnknownNodeType","Unknown node type: %1",type));
|
return MML.Error(_("UnknownNodeType","Unknown node type: %1",type));
|
||||||
if (MathJax.Localization.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
|
|
||||||
return err;
|
|
||||||
} else {
|
} else {
|
||||||
mml = MML[type]();
|
mml = MML[type]();
|
||||||
}
|
}
|
||||||
|
@ -269,8 +267,7 @@
|
||||||
formatError: function (err,math,script) {
|
formatError: function (err,math,script) {
|
||||||
var message = err.message.replace(/\n.*/,"");
|
var message = err.message.replace(/\n.*/,"");
|
||||||
MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]);
|
MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]);
|
||||||
var mml = MML.merror(message);
|
return MML.Error(message);
|
||||||
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
|
|
||||||
},
|
},
|
||||||
Error: function (message) {
|
Error: function (message) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -2099,8 +2099,7 @@
|
||||||
formatError: function (err,math,display,script) {
|
formatError: function (err,math,display,script) {
|
||||||
var message = err.message.replace(/\n.*/,"");
|
var message = err.message.replace(/\n.*/,"");
|
||||||
HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]);
|
HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]);
|
||||||
var mml = MML.merror(message);
|
return MML.Error(message);
|
||||||
return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -45,8 +45,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
} else {
|
} else {
|
||||||
if (values.alt === "")
|
if (values.alt === "")
|
||||||
{values.alt = LOCALE._(["MathML","BadMglyphFont"],"Bad font: %1",font.family)}
|
{values.alt = LOCALE._(["MathML","BadMglyphFont"],"Bad font: %1",font.family)}
|
||||||
err = MML.merror(values.alt).With({mathsize:"75%"});
|
err = MML.Error(values.alt).With({mathsize:"75%"});
|
||||||
if (LOCALE.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
|
|
||||||
this.Append(err); err.toHTML(span); this.data.pop();
|
this.Append(err); err.toHTML(span); this.data.pop();
|
||||||
span.bbox = err.HTMLspanElement().bbox;
|
span.bbox = err.HTMLspanElement().bbox;
|
||||||
}
|
}
|
||||||
|
@ -63,10 +62,9 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
MathJax.Hub.RestartAfter(img.onload);
|
MathJax.Hub.RestartAfter(img.onload);
|
||||||
}
|
}
|
||||||
if (this.img.status !== "OK") {
|
if (this.img.status !== "OK") {
|
||||||
err = MML.merror(
|
err = MML.Error(
|
||||||
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
|
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
|
||||||
).With({mathsize:"75%"});
|
).With({mathsize:"75%"});
|
||||||
if (LOCALE.fontDirection()) {err = MML.mstyle(err).With({dir: "rtl"})};
|
|
||||||
this.Append(err); err.toHTML(span); this.data.pop();
|
this.Append(err); err.toHTML(span); this.data.pop();
|
||||||
span.bbox = err.HTMLspanElement().bbox;
|
span.bbox = err.HTMLspanElement().bbox;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1724,8 +1724,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
HTMLhandleDir: function (span) {
|
HTMLhandleDir: function (span) {
|
||||||
span.style.direction = this.Get("dir");
|
var dir = this.Get("dir",true); // only get value if not the default
|
||||||
return span;
|
if (dir) {span.dir = dir}
|
||||||
|
return span;
|
||||||
},
|
},
|
||||||
|
|
||||||
HTMLhandleColor: function (span) {
|
HTMLhandleColor: function (span) {
|
||||||
|
@ -2305,7 +2306,6 @@
|
||||||
}
|
}
|
||||||
this.HTMLhandleSpace(span);
|
this.HTMLhandleSpace(span);
|
||||||
this.HTMLhandleColor(span);
|
this.HTMLhandleColor(span);
|
||||||
this.HTMLhandleDir(span);
|
|
||||||
return span;
|
return span;
|
||||||
},
|
},
|
||||||
HTMLstretchH: MML.mbase.HTMLstretchH,
|
HTMLstretchH: MML.mbase.HTMLstretchH,
|
||||||
|
@ -2699,10 +2699,6 @@
|
||||||
// Add color (if any)
|
// Add color (if any)
|
||||||
//
|
//
|
||||||
this.HTMLhandleColor(span);
|
this.HTMLhandleColor(span);
|
||||||
//
|
|
||||||
// Add direction (if any)
|
|
||||||
//
|
|
||||||
this.HTMLhandleDir(span);
|
|
||||||
//
|
//
|
||||||
// Make math span be the correct height and depth
|
// Make math span be the correct height and depth
|
||||||
//
|
//
|
||||||
|
|
|
@ -74,7 +74,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
MathJax.Hub.RestartAfter(img.onload);
|
MathJax.Hub.RestartAfter(img.onload);
|
||||||
}
|
}
|
||||||
if (this.img.status !== "OK") {
|
if (this.img.status !== "OK") {
|
||||||
err = MML.merror(
|
err = MML.Error(
|
||||||
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
|
LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
|
||||||
).With({mathsize:"75%"});
|
).With({mathsize:"75%"});
|
||||||
this.Append(err); svg = err.toSVG(); this.data.pop();
|
this.Append(err); svg = err.toSVG(); this.data.pop();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user