Fix problems with mtable, ms, and mmultiscripts which weren't handling styles. Also fix an issue with mphatom that caused processing errors (resolves problem Fred reported in issue #109). Fixed a typo, and don't inherit styles in saveData.
This commit is contained in:
parent
ed0eb9c0c4
commit
01219f413f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var b="2.0";var a=MathJax.ElementJax.mml,c=MathJax.OutputJax.SVG;a.mmultiscripts.Augment({toSVG:function(G,z){var B=this.SVG();this.SVGhandleSpace();var M=this.SVGgetScale();var j=(this.data[this.base]?this.SVGdataStretched(this.base,G,z):c.BBOX.G().Clean());var K=c.TeX.x_height*M,y=c.TeX.scriptspace*M*0.75;var x=this.SVGgetScripts(y);var k=x[0],e=x[1],n=x[2],i=x[3];var g=(this.data[1]||this).SVGgetScale();var C=c.TeX.sup_drop*g,A=c.TeX.sub_drop*g;var o=j.h-C,m=j.d+A,L=0,F;if(j.ic){L=j.ic}if(this.data[this.base]&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&j.scale===1&&!j.stretched&&!this.data[this.base].Get("largeop")){o=m=0}}var H=this.getValues("subscriptshift","superscriptshift"),E=this.SVGgetMu(B);H.subscriptshift=(H.subscriptshift===""?0:c.length2em(H.subscriptshift,E));H.superscriptshift=(H.superscriptshift===""?0:c.length2em(H.superscriptshift,E));var l=0;if(n){l=n.w+L}else{if(i){l=i.w-L}}B.Add(j,Math.max(0,l),0);if(!e&&!i){m=Math.max(m,c.TeX.sub1*M,H.subscriptshift);if(k){m=Math.max(m,k.h-(4/5)*K)}if(n){m=Math.max(m,n.h-(4/5)*K)}if(k){B.Add(k,l+j.w+y-L,-m)}if(n){B.Add(n,0,-m)}}else{if(!k&&!n){var f=this.getValues("displaystyle","texprimestyle");F=c.TeX[(f.displaystyle?"sup1":(f.texprimestyle?"sup3":"sup2"))];o=Math.max(o,F*M,H.superscriptshift);if(e){o=Math.max(o,e.d+(1/4)*K)}if(i){o=Math.max(o,i.d+(1/4)*K)}if(e){B.Add(e,l+j.w+y,o)}if(i){B.Add(i,0,o)}}else{m=Math.max(m,c.TeX.sub2*M);var w=c.TeX.rule_thickness*M;var I=(k||n).h,J=(e||i).d;if(n){I=Math.max(I,n.h)}if(i){J=Math.max(J,i.d)}if((o-J)-(I-m)<3*w){m=3*w-o+J+I;C=(4/5)*K-(o-J);if(C>0){o+=C;m-=C}}o=Math.max(o,H.superscriptshift);m=Math.max(m,H.subscriptshift);if(e){B.Add(e,l+j.w+y,o)}if(i){B.Add(i,l+L-i.w,o)}if(k){B.Add(k,l+j.w+y-L,-m)}if(n){B.Add(n,l-n.w,-m)}}}B.Clean();this.SVGhandleColor(B);this.SVGsaveData(B);return B},SVGgetScripts:function(p){var o,d,e=[];var n=1,g=this.data.length,f=0;for(var h=0;h<4;h+=2){while(n<g&&this.data[n].type!=="mprescripts"){for(var l=h;l<h+2;l++){if(this.data[n]&&this.data[n].type!=="none"){if(!e[l]){e[l]=c.BBOX.G()}e[l].Add(this.data[n].toSVG().With({x:f}))}n++}d=e[h]||{w:0};o=e[h+1]||{w:0};d.w=o.w=f=Math.max(d.w,o.w)}n++;f=0}for(l=0;l<4;l++){if(e[l]){e[l].w+=p;e[l].Clean()}}return e}});MathJax.Hub.Startup.signal.Post("SVG mmultiscripts Ready");MathJax.Ajax.loadComplete(c.autoloadDir+"/mmultiscripts.js")});
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var b="2.0.1";var a=MathJax.ElementJax.mml,c=MathJax.OutputJax.SVG;a.mmultiscripts.Augment({toSVG:function(G,z){this.SVGgetStyles();var B=this.SVG();this.SVGhandleSpace();var M=this.SVGgetScale();var j=(this.data[this.base]?this.SVGdataStretched(this.base,G,z):c.BBOX.G().Clean());var K=c.TeX.x_height*M,y=c.TeX.scriptspace*M*0.75;var x=this.SVGgetScripts(y);var k=x[0],e=x[1],n=x[2],i=x[3];var g=(this.data[1]||this).SVGgetScale();var C=c.TeX.sup_drop*g,A=c.TeX.sub_drop*g;var o=j.h-C,m=j.d+A,L=0,F;if(j.ic){L=j.ic}if(this.data[this.base]&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&j.scale===1&&!j.stretched&&!this.data[this.base].Get("largeop")){o=m=0}}var H=this.getValues("subscriptshift","superscriptshift"),E=this.SVGgetMu(B);H.subscriptshift=(H.subscriptshift===""?0:c.length2em(H.subscriptshift,E));H.superscriptshift=(H.superscriptshift===""?0:c.length2em(H.superscriptshift,E));var l=0;if(n){l=n.w+L}else{if(i){l=i.w-L}}B.Add(j,Math.max(0,l),0);if(!e&&!i){m=Math.max(m,c.TeX.sub1*M,H.subscriptshift);if(k){m=Math.max(m,k.h-(4/5)*K)}if(n){m=Math.max(m,n.h-(4/5)*K)}if(k){B.Add(k,l+j.w+y-L,-m)}if(n){B.Add(n,0,-m)}}else{if(!k&&!n){var f=this.getValues("displaystyle","texprimestyle");F=c.TeX[(f.displaystyle?"sup1":(f.texprimestyle?"sup3":"sup2"))];o=Math.max(o,F*M,H.superscriptshift);if(e){o=Math.max(o,e.d+(1/4)*K)}if(i){o=Math.max(o,i.d+(1/4)*K)}if(e){B.Add(e,l+j.w+y,o)}if(i){B.Add(i,0,o)}}else{m=Math.max(m,c.TeX.sub2*M);var w=c.TeX.rule_thickness*M;var I=(k||n).h,J=(e||i).d;if(n){I=Math.max(I,n.h)}if(i){J=Math.max(J,i.d)}if((o-J)-(I-m)<3*w){m=3*w-o+J+I;C=(4/5)*K-(o-J);if(C>0){o+=C;m-=C}}o=Math.max(o,H.superscriptshift);m=Math.max(m,H.subscriptshift);if(e){B.Add(e,l+j.w+y,o)}if(i){B.Add(i,l+L-i.w,o)}if(k){B.Add(k,l+j.w+y-L,-m)}if(n){B.Add(n,l-n.w,-m)}}}B.Clean();this.SVGhandleColor(B);this.SVGsaveData(B);return B},SVGgetScripts:function(p){var o,d,e=[];var n=1,g=this.data.length,f=0;for(var h=0;h<4;h+=2){while(n<g&&this.data[n].type!=="mprescripts"){for(var l=h;l<h+2;l++){if(this.data[n]&&this.data[n].type!=="none"){if(!e[l]){e[l]=c.BBOX.G()}e[l].Add(this.data[n].toSVG().With({x:f}))}n++}d=e[h]||{w:0};o=e[h+1]||{w:0};d.w=o.w=f=Math.max(d.w,o.w)}n++;f=0}for(l=0;l<4;l++){if(e[l]){e[l].w+=p;e[l].Clean()}}return e}});MathJax.Hub.Startup.signal.Post("SVG mmultiscripts Ready");MathJax.Ajax.loadComplete(c.autoloadDir+"/mmultiscripts.js")});
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var b="2.0";var a=MathJax.ElementJax.mml,c=MathJax.OutputJax.SVG;a.ms.Augment({toSVG:function(){var e=this.SVG();this.SVGhandleSpace(e);var d=this.getValues("lquote","rquote");var f=this.SVGgetVariant(),i=this.SVGgetScale();var h=this.data.join("");var g=[];if(d.lquote.length===1){g.push(this.SVGquoteRegExp(d.lquote))}if(d.rquote.length===1){g.push(this.SVGquoteRegExp(d.rquote))}if(g.length){h=h.replace(RegExp("("+g.join("|")+")","g"),"\\$1")}e.Add(this.SVGhandleVariant(f,i,d.lquote+h+d.rquote));e.Clean();this.SVGhandleColor(e);this.SVGsaveData(e);return e},SVGquoteRegExp:function(d){return d.replace(/([.*+?|{}()\[\]\\])/g,"\\$1")}});a.ms.prototype.defaults.mathvariant="monospace";MathJax.Hub.Startup.signal.Post("SVG ms Ready");MathJax.Ajax.loadComplete(c.autoloadDir+"/ms.js")});
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var b="2.0.1";var a=MathJax.ElementJax.mml,c=MathJax.OutputJax.SVG;a.ms.Augment({toSVG:function(){this.SVGgetStyles();var e=this.SVG();this.SVGhandleSpace(e);var d=this.getValues("lquote","rquote");var f=this.SVGgetVariant(),i=this.SVGgetScale();var h=this.data.join("");var g=[];if(d.lquote.length===1){g.push(this.SVGquoteRegExp(d.lquote))}if(d.rquote.length===1){g.push(this.SVGquoteRegExp(d.rquote))}if(g.length){h=h.replace(RegExp("("+g.join("|")+")","g"),"\\$1")}e.Add(this.SVGhandleVariant(f,i,d.lquote+h+d.rquote));e.Clean();this.SVGhandleColor(e);this.SVGsaveData(e);return e},SVGquoteRegExp:function(d){return d.replace(/([.*+?|{}()\[\]\\])/g,"\\$1")}});a.ms.prototype.defaults.mathvariant="monospace";MathJax.Hub.Startup.signal.Post("SVG ms Ready");MathJax.Ajax.loadComplete(c.autoloadDir+"/ms.js")});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.OutputJax.SVG=MathJax.OutputJax({id:"SVG",version:"2.0",directory:MathJax.OutputJax.directory+"/SVG",extensionDir:MathJax.OutputJax.extensionDir+"/SVG",autoloadDir:MathJax.OutputJax.directory+"/SVG/autoload",fontDir:MathJax.OutputJax.directory+"/SVG/fonts",config:{scale:100,minScaleAdjust:50,font:"TeX",blacker:10,mtextFontInherit:false,undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",addMMLclasses:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_SVG_Display":{"text-align":"center",margin:"1em 0em"},"#MathJax_SVG_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",padding:"3px 4px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.SVG.Register("jax/mml")}MathJax.OutputJax.SVG.loadComplete("config.js");
|
MathJax.OutputJax.SVG=MathJax.OutputJax({id:"SVG",version:"2.0.1",directory:MathJax.OutputJax.directory+"/SVG",extensionDir:MathJax.OutputJax.extensionDir+"/SVG",autoloadDir:MathJax.OutputJax.directory+"/SVG/autoload",fontDir:MathJax.OutputJax.directory+"/SVG/fonts",config:{scale:100,minScaleAdjust:50,font:"TeX",blacker:10,mtextFontInherit:false,undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",addMMLclasses:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_SVG_Display":{"text-align":"center",margin:"1em 0em"},"#MathJax_SVG_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",padding:"3px 4px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.SVG.Register("jax/mml")}MathJax.OutputJax.SVG.loadComplete("config.js");
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,12 +22,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
var VERSION = "2.0";
|
var VERSION = "2.0.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
SVG = MathJax.OutputJax.SVG;
|
SVG = MathJax.OutputJax.SVG;
|
||||||
|
|
||||||
MML.mmultiscripts.Augment({
|
MML.mmultiscripts.Augment({
|
||||||
toSVG: function (HW,D) {
|
toSVG: function (HW,D) {
|
||||||
|
this.SVGgetStyles();
|
||||||
var svg = this.SVG(); this.SVGhandleSpace();
|
var svg = this.SVG(); this.SVGhandleSpace();
|
||||||
var scale = this.SVGgetScale();
|
var scale = this.SVGgetScale();
|
||||||
var base = (this.data[this.base] ? this.SVGdataStretched(this.base,HW,D) : SVG.BBOX.G().Clean());
|
var base = (this.data[this.base] ? this.SVGdataStretched(this.base,HW,D) : SVG.BBOX.G().Clean());
|
||||||
|
|
|
@ -22,12 +22,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
var VERSION = "2.0";
|
var VERSION = "2.0.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
SVG = MathJax.OutputJax.SVG;
|
SVG = MathJax.OutputJax.SVG;
|
||||||
|
|
||||||
MML.ms.Augment({
|
MML.ms.Augment({
|
||||||
toSVG: function () {
|
toSVG: function () {
|
||||||
|
this.SVGgetStyles();
|
||||||
var svg = this.SVG(); this.SVGhandleSpace(svg);
|
var svg = this.SVG(); this.SVGhandleSpace(svg);
|
||||||
var values = this.getValues("lquote","rquote");
|
var values = this.getValues("lquote","rquote");
|
||||||
var variant = this.SVGgetVariant(), scale = this.SVGgetScale();
|
var variant = this.SVGgetVariant(), scale = this.SVGgetScale();
|
||||||
|
|
|
@ -22,13 +22,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
||||||
var VERSION = "2.0";
|
var VERSION = "2.0.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
SVG = MathJax.OutputJax.SVG,
|
SVG = MathJax.OutputJax.SVG,
|
||||||
BBOX = SVG.BBOX;
|
BBOX = SVG.BBOX;
|
||||||
|
|
||||||
MML.mtable.Augment({
|
MML.mtable.Augment({
|
||||||
toSVG: function (span) {
|
toSVG: function (span) {
|
||||||
|
this.SVGgetStyles();
|
||||||
var svg = this.SVG();
|
var svg = this.SVG();
|
||||||
if (this.data.length === 0) {return svg}
|
if (this.data.length === 0) {return svg}
|
||||||
var values = this.getValues("columnalign","rowalign","columnspacing","rowspacing",
|
var values = this.getValues("columnalign","rowalign","columnspacing","rowspacing",
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
MathJax.OutputJax.SVG = MathJax.OutputJax({
|
MathJax.OutputJax.SVG = MathJax.OutputJax({
|
||||||
id: "SVG",
|
id: "SVG",
|
||||||
version: "2.0",
|
version: "2.0.1",
|
||||||
directory: MathJax.OutputJax.directory + "/SVG",
|
directory: MathJax.OutputJax.directory + "/SVG",
|
||||||
extensionDir: MathJax.OutputJax.extensionDir + "/SVG",
|
extensionDir: MathJax.OutputJax.extensionDir + "/SVG",
|
||||||
autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload",
|
autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload",
|
||||||
|
|
|
@ -1013,7 +1013,7 @@
|
||||||
svg.removeable = false;
|
svg.removeable = false;
|
||||||
svg.element.setAttribute("className","mjx-svg-"+this.type);
|
svg.element.setAttribute("className","mjx-svg-"+this.type);
|
||||||
}
|
}
|
||||||
var style = this.Get("style");
|
var style = this.style;
|
||||||
if (style) {
|
if (style) {
|
||||||
svg.element.style.cssText = style;
|
svg.element.style.cssText = style;
|
||||||
if (svg.element.style.fontSize) {svg.element.style.fontSize = ""} // handled by scale
|
if (svg.element.style.fontSize) {svg.element.style.fontSize = ""} // handled by scale
|
||||||
|
@ -1091,7 +1091,7 @@
|
||||||
if (values.background !== MML.COLOR.TRANSPARENT) {
|
if (values.background !== MML.COLOR.TRANSPARENT) {
|
||||||
if (svg.element.nodeName !== "g" && svg.element.nodeName !== "svg") {
|
if (svg.element.nodeName !== "g" && svg.element.nodeName !== "svg") {
|
||||||
var g = SVG.Element("g"); g.appendChild(svg.element);
|
var g = SVG.Element("g"); g.appendChild(svg.element);
|
||||||
svg.element = g; svg.removable = true;
|
svg.element = g; svg.removeable = true;
|
||||||
}
|
}
|
||||||
svg.Add(BBOX.RECT(svg.h,svg.d,svg.w,{fill:values.background,stroke:"none"}),0,0,false,true)
|
svg.Add(BBOX.RECT(svg.h,svg.d,svg.w,{fill:values.background,stroke:"none"}),0,0,false,true)
|
||||||
}
|
}
|
||||||
|
@ -1428,8 +1428,8 @@
|
||||||
while (svg.element.firstChild) {svg.element.removeChild(svg.element.firstChild)}
|
while (svg.element.firstChild) {svg.element.removeChild(svg.element.firstChild)}
|
||||||
}
|
}
|
||||||
this.SVGhandleColor(svg);
|
this.SVGhandleColor(svg);
|
||||||
if (!svg.element.firstChild) {delete svg.element}
|
|
||||||
this.SVGsaveData(svg);
|
this.SVGsaveData(svg);
|
||||||
|
if (svg.removeable && !svg.element.firstChild) {delete svg.element}
|
||||||
return svg;
|
return svg;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user