commit 96f16e186805278f8caeebc771e8efb5d075abcd
parent cc34c39def9463371931fe6df5d8a91b9d6f673e
Author: Frédéric Wang <fred.wang@free.fr>
Date: Fri, 31 May 2013 09:14:47 +0200
Address review comments for issue #481.
Diffstat:
4 files changed, 43 insertions(+), 41 deletions(-)
diff --git a/unpacked/extensions/TeX/cancel.js b/unpacked/extensions/TeX/cancel.js
@@ -96,7 +96,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var value = this.ParseArg(name),
attr = this.GetBrackets(name,""),
math = this.ParseArg(name);
- var def = CANCEL.setAttributes({notation: MML.NOTATION.UPDIAGONALARROW},attr);
+ var def = CANCEL.setAttributes({notation: MML.NOTATION.UPDIAGONALSTRIKE+" "+MML.NOTATION.UPDIAGONALARROW},attr);
value = MML.mpadded(value).With({depth:"-.1em",height:"+.1em",voffset:".1em"});
this.Push(MML.msup(MML.menclose(math).With(def),value));
}
diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js
@@ -96,11 +96,11 @@
for (var i = 0, m = CLASS.length; i < m; i++) {
if (CLASS[i].substr(0,4) === "MJX-") {
if (CLASS[i] === "MJX-arrow") {
- // This class was used in former version of MathJax to add an
+ // This class was used in former versions of MathJax to attach an
// arrow to the updiagonalstrike notation. For backward
- // compatibility, continue to handle this as updiagonalarrow.
- mml.notation = mml.notation.replace(MML.NOTATION.UPDIAGONALSTRIKE,
- MML.NOTATION.UPDIAGONALARROW);
+ // compatibility, let's continue to accept this case. See issue 481.
+ if (!mml.notation.match("/"+MML.NOTATION.UPDIAGONALARROW+"/"))
+ mml.notation += " "+MML.NOTATION.UPDIAGONALARROW;
} else if (CLASS[i] === "MJX-variant") {
mml.variantForm = true;
//
diff --git a/unpacked/jax/output/HTML-CSS/autoload/menclose.js b/unpacked/jax/output/HTML-CSS/autoload/menclose.js
@@ -62,7 +62,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (notation[MML.NOTATION.UPDIAGONALARROW]) notation[MML.NOTATION.UPDIAGONALSTRIKE] = false;
for (var n in notation) {
- if (!notation[n]) continue;
+ if (!notation.hasOwnProperty(n) || !notation[n]) continue;
switch (n) {
case MML.NOTATION.BOX:
frame.style.border = SOLID; if (!HTMLCSS.msieBorderWidthBug) {T = B = L = R = t}
@@ -135,36 +135,39 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
break;
case MML.NOTATION.UPDIAGONALSTRIKE:
+ if (HTMLCSS.useVML) {
+ if (!vml) {vml = this.HTMLvml(stack,H,D,W,t,values.mathcolor)}
+ var line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+",0"});
+ } else {
+ if (!svg) {svg = this.HTMLsvg(stack,H,D,W,t,values.mathcolor)}
+ this.HTMLsvgElement(svg.firstChild,"line",{
+ x1:1, y1:this.HTMLpx(H+D-t), x2:this.HTMLpx(W-t), y2:this.HTMLpx(t)
+ });
+ }
+ break;
+
case MML.NOTATION.UPDIAGONALARROW:
if (HTMLCSS.useVML) {
if (!vml) {vml = this.HTMLvml(stack,H,D,W,t,values.mathcolor)}
var line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+",0"});
- if (n == MML.NOTATION.UPDIAGONALARROW) {
- this.HTMLvmlElement(line,"stroke",{endarrow:"classic"});
- line.to = this.HTMLpx(W)+","+this.HTMLpx(t);
- }
+ this.HTMLvmlElement(line,"stroke",{endarrow:"classic"});
+ line.to = this.HTMLpx(W)+","+this.HTMLpx(t);
} else {
if (!svg) {svg = this.HTMLsvg(stack,H,D,W,t,values.mathcolor)}
- if (n == MML.NOTATION.UPDIAGONALARROW) {
- var l = Math.sqrt(W*W + (H+D)*(H+D)), f = 1/l * 10*scale/HTMLCSS.em * t/.075;
- w = W * f; h = (H+D) * f; var x = W - t/2, y = t/2;
- if (y+h-.4*w < 0) {y = .4*w-h}
- this.HTMLsvgElement(svg.firstChild,"line",{
- x1:1, y1:this.HTMLpx(H+D-t), x2:this.HTMLpx(x-.7*w), y2:this.HTMLpx(y+.7*h)
- });
- this.HTMLsvgElement(svg.firstChild,"polygon",{
- points: this.HTMLpx(x)+","+this.HTMLpx(y)+" "
- +this.HTMLpx(x-w-.4*h)+","+this.HTMLpx(y+h-.4*w)+" "
- +this.HTMLpx(x-.7*w)+","+this.HTMLpx(y+.7*h)+" "
- +this.HTMLpx(x-w+.4*h)+","+this.HTMLpx(y+h+.4*w)+" "
- +this.HTMLpx(x)+","+this.HTMLpx(y),
- fill:values.mathcolor, stroke:"none"
- });
- } else {
- this.HTMLsvgElement(svg.firstChild,"line",{
- x1:1, y1:this.HTMLpx(H+D-t), x2:this.HTMLpx(W-t), y2:this.HTMLpx(t)
- });
- }
+ var l = Math.sqrt(W*W + (H+D)*(H+D)), f = 1/l * 10*scale/HTMLCSS.em * t/.075;
+ w = W * f; h = (H+D) * f; var x = W - t/2, y = t/2;
+ if (y+h-.4*w < 0) {y = .4*w-h}
+ this.HTMLsvgElement(svg.firstChild,"line",{
+ x1:1, y1:this.HTMLpx(H+D-t), x2:this.HTMLpx(x-.7*w), y2:this.HTMLpx(y+.7*h)
+ });
+ this.HTMLsvgElement(svg.firstChild,"polygon",{
+ points: this.HTMLpx(x)+","+this.HTMLpx(y)+" "
+ +this.HTMLpx(x-w-.4*h)+","+this.HTMLpx(y+h-.4*w)+" "
+ +this.HTMLpx(x-.7*w)+","+this.HTMLpx(y+.7*h)+" "
+ +this.HTMLpx(x-w+.4*h)+","+this.HTMLpx(y+h+.4*w)+" "
+ +this.HTMLpx(x)+","+this.HTMLpx(y),
+ fill:values.mathcolor, stroke:"none"
+ });
}
break;
diff --git a/unpacked/jax/output/SVG/autoload/menclose.js b/unpacked/jax/output/SVG/autoload/menclose.js
@@ -120,7 +120,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
if (notation[MML.NOTATION.UPDIAGONALARROW]) notation[MML.NOTATION.UPDIAGONALSTRIKE] = false;
for (var n in notation) {
- if (!notation[n]) continue;
+ if (!notation.hasOwnProperty(n) || !notation[n]) continue;
switch (n) {
case MML.NOTATION.BOX:
borders = [true,true,true,true];
@@ -162,17 +162,16 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
break;
case MML.NOTATION.UPDIAGONALSTRIKE:
+ svg.Add(BBOX.DLINE(H,D,W,t,values.mathcolor,"up"));
+ break;
+
case MML.NOTATION.UPDIAGONALARROW:
- if (n == MML.NOTATION.UPDIAGONALARROW) {
- var l = Math.sqrt(W*W + (H+D)*(H+D)), f = 1/l * 10/SVG.em * t/.075;
- w = W * f; h = (H+D) * f; var x = .4*h;
- svg.Add(BBOX.DLINE(H-.5*h,D,W-.5*w,t,values.mathcolor,"up"));
- svg.Add(BBOX.FPOLY(
- [[x+w,h], [x-.4*h,.4*w], [x+.3*w,.3*h], [x+.4*h,-.4*w], [x+w,h]],
- values.mathcolor),W-w-x,H-h);
- } else {
- svg.Add(BBOX.DLINE(H,D,W,t,values.mathcolor,"up"));
- }
+ var l = Math.sqrt(W*W + (H+D)*(H+D)), f = 1/l * 10/SVG.em * t/.075;
+ w = W * f; h = (H+D) * f; var x = .4*h;
+ svg.Add(BBOX.DLINE(H-.5*h,D,W-.5*w,t,values.mathcolor,"up"));
+ svg.Add(BBOX.FPOLY(
+ [[x+w,h], [x-.4*h,.4*w], [x+.3*w,.3*h], [x+.4*h,-.4*w], [x+w,h]],
+ values.mathcolor),W-w-x,H-h);
break;
case MML.NOTATION.DOWNDIAGONALSTRIKE: