commit 932b7e8f7c8511578c89229ba189584cc50834ec
parent 830502a0a344d3714dddca0320426bbd1d97fd83
Author: Frédéric Wang <fred.wang@free.fr>
Date: Fri, 18 Oct 2013 10:04:47 +0200
Experimental Bidi branch. #474, #/610, #627
Diffstat:
6 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js
@@ -232,7 +232,8 @@ MathJax.ElementJax.mml.Augment({
type: "base", isToken: false,
defaults: {
mathbackground: MML.INHERIT,
- mathcolor: MML.INHERIT
+ mathcolor: MML.INHERIT,
+ dir: MML.INHERIT,
},
noInherit: {},
noInheritAttribute: {
@@ -428,7 +429,8 @@ MathJax.ElementJax.mml.Augment({
mathvariant: MML.AUTO,
mathsize: MML.INHERIT,
mathbackground: MML.INHERIT,
- mathcolor: MML.INHERIT
+ mathcolor: MML.INHERIT,
+ dir: MML.INHERIT
},
autoDefault: function (name) {
if (name === "mathvariant") {
@@ -458,7 +460,8 @@ MathJax.ElementJax.mml.Augment({
mathvariant: MML.INHERIT,
mathsize: MML.INHERIT,
mathbackground: MML.INHERIT,
- mathcolor: MML.INHERIT
+ mathcolor: MML.INHERIT,
+ dir: MML.INHERIT
}
});
@@ -469,6 +472,7 @@ MathJax.ElementJax.mml.Augment({
mathsize: MML.INHERIT,
mathbackground: MML.INHERIT,
mathcolor: MML.INHERIT,
+ dir: MML.INHERIT,
form: MML.AUTO,
fence: MML.AUTO,
separator: MML.AUTO,
@@ -630,7 +634,8 @@ MathJax.ElementJax.mml.Augment({
mathvariant: MML.INHERIT,
mathsize: MML.INHERIT,
mathbackground: MML.INHERIT,
- mathcolor: MML.INHERIT
+ mathcolor: MML.INHERIT,
+ dir: MML.INHERIT
}
});
@@ -665,6 +670,7 @@ MathJax.ElementJax.mml.Augment({
mathsize: MML.INHERIT,
mathbackground: MML.INHERIT,
mathcolor: MML.INHERIT,
+ dir: MML.INHERIT,
lquote: '"',
rquote: '"'
}
@@ -810,6 +816,7 @@ MathJax.ElementJax.mml.Augment({
scriptminsize: "8pt",
mathbackground: MML.INHERIT,
mathcolor: MML.INHERIT,
+ dir: MML.INHERIT,
infixlinebreakstyle: MML.LINEBREAKSTYLE.BEFORE,
decimalseparator: "."
},
@@ -1226,6 +1233,7 @@ MathJax.ElementJax.mml.Augment({
mathsize: MML.SIZE.NORMAL,
mathcolor: "", // should be "black", but allow it to inherit from surrounding text
mathbackground: MML.COLOR.TRANSPARENT,
+ dir: "ltr",
scriptlevel: 0,
displaystyle: MML.AUTO,
display: "inline",
diff --git a/unpacked/jax/input/AsciiMath/jax.js b/unpacked/jax/input/AsciiMath/jax.js
@@ -1292,7 +1292,8 @@ junk = null;
formatError: function (err,math,script) {
var message = err.message.replace(/\n.*/,"");
MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",message,math,script]);
- return MML.merror(message);
+ var mml = MML.merror(message);
+ return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
},
Error: function (message) {
throw MathJax.Hub.Insert(Error(message),{asciimathError: true});
diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js
@@ -267,7 +267,8 @@
formatError: function (err,math,script) {
var message = err.message.replace(/\n.*/,"");
MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]);
- return MML.merror(message);
+ var mml = MML.merror(message);
+ return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
},
Error: function (message) {
//
diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js
@@ -2099,7 +2099,8 @@
formatError: function (err,math,display,script) {
var message = err.message.replace(/\n.*/,"");
HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]);
- return MML.merror(message);
+ var mml = MML.merror(message);
+ return (MathJax.Localization.fontDirection() ? MML.mstyle(mml).With({dir: "rtl"}) : mml);
},
//
diff --git a/unpacked/jax/output/HTML-CSS/autoload/ms.js b/unpacked/jax/output/HTML-CSS/autoload/ms.js
@@ -41,6 +41,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
this.HTMLhandleVariant(span,this.HTMLgetVariant(),values.lquote+text+values.rquote);
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
},
HTMLquoteRegExp: function (string) {
diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js
@@ -223,7 +223,6 @@
"word-wrap": "normal",
"white-space": "nowrap",
"float": "none",
- "direction": "ltr",
border: 0, padding: 0, margin: 0
},
@@ -1723,6 +1722,11 @@
return span;
},
+ HTMLhandleDir: function (span) {
+ span.style.direction = this.Get("dir");
+ return span;
+ },
+
HTMLhandleColor: function (span) {
var values = this.getValues("mathcolor","color");
if (this.mathbackground) {values.mathbackground = this.mathbackground}
@@ -1973,6 +1977,7 @@
}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
}
});
@@ -1987,6 +1992,7 @@
if (this.data.join("").length !== 1) {delete span.bbox.skew}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
}
});
@@ -2061,6 +2067,7 @@
//
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
},
CoreParent: function () {
@@ -2157,6 +2164,7 @@
if (this.data.join("").length !== 1) {delete span.bbox.skew}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
}
});
@@ -2296,6 +2304,7 @@
}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
+ this.HTMLhandleDir(span);
return span;
},
HTMLstretchH: MML.mbase.HTMLstretchH,
@@ -2689,6 +2698,10 @@
// Add color (if any)
//
this.HTMLhandleColor(span);
+ //
+ // Add direction (if any)
+ //
+ this.HTMLhandleDir(span);
//
// Make math span be the correct height and depth
//