Merge remote-tracking branch 'mathjax/develop' into ctop
Conflicts: unpacked/extensions/MathML/content-mathml.js
This commit is contained in:
commit
0e0444ec3f
|
@ -40,7 +40,7 @@
|
|||
fontCheckTimeout: 15 * 1000, // how long to keep looking for fonts (15 seconds)
|
||||
});
|
||||
|
||||
var MATCH = MathJax.Extension.MatchWebFonts = {
|
||||
MathJax.Extension.MatchWebFonts = {
|
||||
version: VERSION,
|
||||
config: CONFIG
|
||||
};
|
||||
|
@ -81,7 +81,6 @@
|
|||
for (i = 0, m = scripts.length; i < m; i++) {
|
||||
script = scripts[i]; if (!script.parentNode) continue; retry = true;
|
||||
var jax = script.MathJax.elementJax; if (!jax) continue;
|
||||
var span = document.getElementById(jax.inputID+"-Frame");
|
||||
//
|
||||
// Check if ex or mex has changed
|
||||
//
|
||||
|
@ -153,13 +152,12 @@
|
|||
for (i = 0, m = scripts.length; i < m; i++) {
|
||||
script = scripts[i]; if (!script.parentNode) continue; retry = true;
|
||||
var jax = script.MathJax.elementJax; if (!jax) continue;
|
||||
var span = document.getElementById(jax.inputID+"-Frame");
|
||||
//
|
||||
// Check if ex or mex has changed
|
||||
//
|
||||
var test = script.previousSibling;
|
||||
var ex = test.firstChild.offsetHeight/60;
|
||||
if (ex === 0 || ex === "NaN") {ex = this.defaultEx; em = this.defaultEm}
|
||||
if (ex === 0 || ex === "NaN") {ex = this.defaultEx}
|
||||
if (ex !== jax.SVG.ex) {size.push(script); scripts[i] = {}}
|
||||
}
|
||||
//
|
||||
|
@ -259,7 +257,7 @@
|
|||
// Check widths of mtd elements
|
||||
//
|
||||
if (math.MathJaxMtds) {
|
||||
for (j = 0, n = math.MathJaxMtds.length; j < n; j++) {
|
||||
for (var j = 0, n = math.MathJaxMtds.length; j < n; j++) {
|
||||
if (!math.MathJaxMtds[j].parentNode) continue;
|
||||
if (newEx || math.MathJaxMtds[j].firstChild.scrollWidth !== jax.mtds[j]) {
|
||||
jax.mtds[j] = math.MathJaxMtds[j].firstChild.scrollWidth;
|
||||
|
|
|
@ -258,7 +258,7 @@
|
|||
overlay.style.display = "";
|
||||
},
|
||||
findContainer: function (obj) {
|
||||
var obj = obj.parentNode;
|
||||
obj = obj.parentNode;
|
||||
while (obj.parentNode && obj !== document.body && ZOOM.getOverflow(obj) === "visible")
|
||||
{obj = obj.parentNode}
|
||||
return obj;
|
||||
|
|
|
@ -74,7 +74,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
keyvalue[1] = keyvalue[1].replace(/^"(.*)"$/,"$1");
|
||||
if (keyvalue[1] === "true") {keyvalue[1] = true}
|
||||
if (keyvalue[1] === "false") {keyvalue[1] = false}
|
||||
def[keyvalue[0]] = keyvalue[1];
|
||||
if (keyvalue[0] === "arrow" && keyvalue[1])
|
||||
{def.notation = def.notation + " updiagonalarrow"} else
|
||||
{def[keyvalue[0]] = keyvalue[1]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -610,7 +610,7 @@ MathJax.ElementJax.mml.Augment({
|
|||
this.texClass = this.Get("texClass");
|
||||
if (this.data.join("") === "\u2061") {
|
||||
// force previous node to be texClass OP, and skip this node
|
||||
if (prev) prev.texClass = MML.TEXCLASS.OP;
|
||||
if (prev) {prev.texClass = MML.TEXCLASS.OP; prev.fnOP = true}
|
||||
this.texClass = this.prevClass = MML.TEXCLASS.NONE;
|
||||
return prev;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ MathJax.ElementJax.mml.Augment({
|
|||
},
|
||||
setTeXclass: function (prev) {
|
||||
var i, m = this.data.length;
|
||||
if (this.open || this.close) {
|
||||
if ((this.open || this.close) && (!prev || !prev.fnOP)) {
|
||||
//
|
||||
// <mrow> came from \left...\right
|
||||
// so treat as subexpression (tex class INNER)
|
||||
|
|
|
@ -1490,7 +1490,7 @@
|
|||
|
||||
Lap: function (name) {
|
||||
var mml = MML.mpadded(this.ParseArg(name)).With({width: 0});
|
||||
if (name === "\\llap") {mml.lspace = "-1 width"}
|
||||
if (name === "\\llap") {mml.lspace = "-1width"}
|
||||
this.Push(MML.TeXAtom(mml));
|
||||
},
|
||||
|
||||
|
@ -1721,7 +1721,7 @@
|
|||
if (!cmd) {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])}
|
||||
if (!(cmd instanceof Array)) {cmd = [cmd]}
|
||||
var end = (cmd[1] instanceof Array ? cmd[1][0] : cmd[1]);
|
||||
mml = STACKITEM.begin().With({name: env, end: end, parse:this});
|
||||
var mml = STACKITEM.begin().With({name: env, end: end, parse:this});
|
||||
if (name === "\\end") {
|
||||
if (!isEnd && cmd[1] instanceof Array && this[cmd[1][1]]) {
|
||||
mml = this[cmd[1][1]].apply(this,[mml].concat(cmd.slice(2)));
|
||||
|
|
|
@ -68,7 +68,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
this.Append(err); err.toHTML(span); this.data.pop();
|
||||
span.bbox = err.HTMLspanElement().bbox;
|
||||
} else {
|
||||
var mu = this.HTMLgetMu(span), size;
|
||||
var mu = this.HTMLgetMu(span);
|
||||
img = HTMLCSS.addElement(span,"img",{isMathJax:true, src:values.src, alt:values.alt, title:values.alt});
|
||||
if (values.width) {
|
||||
img.style.width = HTMLCSS.Em(HTMLCSS.length2em(values.width,mu,this.img.img.width/HTMLCSS.em));
|
||||
|
|
|
@ -570,8 +570,11 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
|||
},
|
||||
|
||||
HTMLmoveLine: function (start,end,span,state,values) {
|
||||
var SPAN = this.HTMLspanElement(), data = SPAN.bbox, base = data,
|
||||
stack = SPAN.firstChild, box = stack.firstChild, dx, BOX = {};
|
||||
var SPAN = this.HTMLspanElement(), data = SPAN.bbox,
|
||||
stack = SPAN.firstChild, BOX = {};
|
||||
if (HTMLCSS.msiePaddingWidthBug) {stack = stack.nextSibling}
|
||||
var box = stack.firstChild;
|
||||
|
||||
//
|
||||
// Get the boxes for the scripts (if any)
|
||||
//
|
||||
|
|
|
@ -380,6 +380,16 @@
|
|||
NeoEulerWeb: "Neo-Euler"
|
||||
},
|
||||
|
||||
fontInUse: "generic",
|
||||
FONTDATA: {
|
||||
TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8,
|
||||
FONTS: {},
|
||||
VARIANT: {
|
||||
"normal": {fonts:[]}, "-generic-variant": {fonts:[]},
|
||||
"-largeOp": {fonts:[]}, "-smallOp": {fonts:[]}
|
||||
}, RANGES: [], DELIMITERS: {}, RULECHAR: 0x2D, REMAP: {}
|
||||
},
|
||||
|
||||
Config: function () {
|
||||
if (!this.require) {this.require = []}
|
||||
this.Font = FONTTEST(); this.SUPER(arguments).Config.call(this);
|
||||
|
@ -414,15 +424,6 @@
|
|||
} else {
|
||||
MESSAGE(["CantFindFontUsing","Can't find a valid font using %1",
|
||||
"["+this.config.availableFonts.join(", ")+"]"],null,3000);
|
||||
this.fontInUse = "generic";
|
||||
this.FONTDATA = {
|
||||
TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8,
|
||||
FONTS: {},
|
||||
VARIANT: {
|
||||
"normal": {fonts:[]}, "-generic-variant": {fonts:[]},
|
||||
"-largeOp": {fonts:[]}, "-smallOp": {fonts:[]}
|
||||
}, RANGES: [], DELIMITERS: {}, RULECHAR: 0x2D, REMAP: {}
|
||||
};
|
||||
HUB.Startup.signal.Post("HTML-CSS Jax - no valid font");
|
||||
}
|
||||
this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js");
|
||||
|
@ -845,20 +846,19 @@
|
|||
getW: function (span) {
|
||||
var W, H, w = (span.bbox||{}).w, start = span;
|
||||
if (span.bbox && span.bbox.exactW) {return w}
|
||||
if ((span.bbox && w >= 0 && !this.initialSkipBug) || this.negativeBBoxes || !span.firstChild) {
|
||||
if ((span.bbox && w >= 0 && !this.initialSkipBug && !this.msieItalicWidthBug) ||
|
||||
this.negativeBBoxes || !span.firstChild) {
|
||||
W = span.offsetWidth; H = span.parentNode.offsetHeight;
|
||||
} else if (span.bbox && w < 0 && this.msieNegativeBBoxBug) {
|
||||
W = -span.offsetWidth, H = span.parentNode.offsetHeight;
|
||||
} else {
|
||||
// IE can't deal with a space at the beginning, so put something else first
|
||||
if (this.initialSkipBug) {
|
||||
var position = span.style.position; span.style.position = "absolute";
|
||||
start = this.startMarker; span.insertBefore(start,span.firstChild)
|
||||
}
|
||||
var position = span.style.position; span.style.position = "absolute";
|
||||
start = this.startMarker; span.insertBefore(start,span.firstChild)
|
||||
span.appendChild(this.endMarker);
|
||||
W = this.endMarker.offsetLeft - start.offsetLeft;
|
||||
span.removeChild(this.endMarker);
|
||||
if (this.initialSkipBug) {span.removeChild(start); span.style.position = position}
|
||||
span.removeChild(start); span.style.position = position
|
||||
}
|
||||
if (H != null) {span.parentNode.HH = H/this.em}
|
||||
return W/this.em;
|
||||
|
@ -1201,6 +1201,14 @@
|
|||
},
|
||||
alignBox: function (span,align,y) {
|
||||
this.placeBox(span,0,y); // set y position (and left aligned)
|
||||
if (this.msiePlaceBoxBug) {
|
||||
//
|
||||
// placeBox() adds an extra , so remove it here.
|
||||
//
|
||||
var node = span.lastChild;
|
||||
while (node && node.nodeName !== "#text") {node = node.previousSibling}
|
||||
if (node) {span.removeChild(node)}
|
||||
}
|
||||
var bbox = span.bbox; if (bbox.isMultiline) return;
|
||||
var isRelative = bbox.width != null && !bbox.isFixed;
|
||||
var r = 0, c = -bbox.w/2, l = "50%";
|
||||
|
@ -1687,7 +1695,7 @@
|
|||
var h = span.bbox.h, d = span.bbox.d, stretched = false;
|
||||
for (i = 0, m = stretchy.length; i < m; i++) {
|
||||
var bbox = stretchy[i].HTMLspanElement().bbox;
|
||||
if (bbox.h !== h || bbox.d !== d)
|
||||
if (stretchy[i].forceStretch || bbox.h !== h || bbox.d !== d)
|
||||
{stretchy[i].HTMLstretchV(span,h,d); stretched = true}
|
||||
}
|
||||
if (stretched) {this.HTMLcomputeBBox(span,true)}
|
||||
|
@ -1914,7 +1922,8 @@
|
|||
|
||||
HTMLgetScale: function () {
|
||||
if (this.scale) {return this.scale * this.mscale}
|
||||
var scale = 1, values = this.getValues("mathsize","scriptlevel","fontsize");
|
||||
var scale = 1, values = this.getValues("scriptlevel","fontsize");
|
||||
values.mathsize = (this.isToken ? this : this.Parent()).Get("mathsize");
|
||||
if (this.style) {
|
||||
var span = this.HTMLspanElement();
|
||||
if (span.style.fontSize != "") {values.fontsize = span.style.fontSize}
|
||||
|
@ -2204,7 +2213,9 @@
|
|||
else if (under && this === under.CoreMO() && parent.Get("accentunder")) {c = HTMLCSS.FONTDATA.REMAPACCENTUNDER[c]||c}
|
||||
}
|
||||
c = HTMLCSS.FONTDATA.DELIMITERS[c.charCodeAt(0)];
|
||||
return (c && c.dir == direction.substr(0,1));
|
||||
var stretch = (c && c.dir === direction.substr(0,1));
|
||||
this.forceStretch = (stretch && (this.Get("minsize",true) || this.Get("maxsize",true)));
|
||||
return stretch;
|
||||
},
|
||||
HTMLstretchV: function (box,h,d) {
|
||||
this.HTMLremoveColor();
|
||||
|
@ -2457,7 +2468,7 @@
|
|||
// (TeXBook pg 150 and Appendix G rule 15e)
|
||||
//
|
||||
var space = HTMLCSS.TeX.nulldelimiterspace * this.mscale;
|
||||
var style = span.firstChild.style;
|
||||
var style = span.childNodes[HTMLCSS.msiePaddingWidthBug ? 1 : 0].style;
|
||||
style.marginLeft = style.marginRight = HTMLCSS.Em(space);
|
||||
span.bbox.w += 2*space; span.bbox.r += 2*space;
|
||||
}
|
||||
|
@ -2898,6 +2909,7 @@
|
|||
msieClipRectBug: !isIE8,
|
||||
msieNegativeSpaceBug: quirks,
|
||||
cloneNodeBug: (isIE8 && browser.version === "8.0"),
|
||||
msieItalicWidthBug: true, // can't measure boxes ending in italics correctly
|
||||
initialSkipBug: (mode < 8), // confused by initial left-margin values
|
||||
msieNegativeBBoxBug: (mode >= 8), // negative bboxes have positive widths
|
||||
msieIE6: !isIE7,
|
||||
|
|
|
@ -195,17 +195,19 @@
|
|||
//
|
||||
// If that fails, give an alert about security settings
|
||||
//
|
||||
alert(MathJax.Localization._(["MathML", "MathPlayer"],
|
||||
"MathJax was not able to set up MathPlayer.\n\n"+
|
||||
"If MathPlayer is not installed, you need to install it first.\n"+
|
||||
"Otherwise, your security settings may be preventing ActiveX \n"+
|
||||
"controls from running. Use the Internet Options item under\n"+
|
||||
"the Tools menu and select the Security tab, then press the\n"+
|
||||
"Custom Level button. Check that the settings for\n"+
|
||||
"'Run ActiveX Controls', and 'Binary and script behaviors'\n"+
|
||||
"are enabled.\n\n"+
|
||||
"Currently you will see error messages rather than\n"+
|
||||
"typeset mathematics."));
|
||||
if (!this.config.noMathPlayerWarning) {
|
||||
alert(MathJax.Localization._(["MathML", "MathPlayer"],
|
||||
"MathJax was not able to set up MathPlayer.\n\n"+
|
||||
"If MathPlayer is not installed, you need to install it first.\n"+
|
||||
"Otherwise, your security settings may be preventing ActiveX \n"+
|
||||
"controls from running. Use the Internet Options item under\n"+
|
||||
"the Tools menu and select the Security tab, then press the\n"+
|
||||
"Custom Level button. Check that the settings for\n"+
|
||||
"'Run ActiveX Controls', and 'Binary and script behaviors'\n"+
|
||||
"are enabled.\n\n"+
|
||||
"Currently you will see error messages rather than\n"+
|
||||
"typeset mathematics."));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
|
|
|
@ -336,7 +336,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
|
|||
if (state.last && svg.X) {svg.X = 0}
|
||||
line.Add(svg,line.w,0,true);
|
||||
}
|
||||
if (state.first && svg.w === 0) {state.nextIsFirst = true}
|
||||
if (state.first && svg && svg.w === 0) {state.nextIsFirst = true}
|
||||
else {delete state.nextIsFirst}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -904,7 +904,7 @@
|
|||
{
|
||||
var svg = this.svg[i], mml = svg.mml;
|
||||
if (mml) {
|
||||
if (mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) {
|
||||
if (mml.forceStretch || mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) {
|
||||
svg = mml.SVGstretchV(this.sh,this.sd);
|
||||
}
|
||||
mml.SVGdata.HW = this.sh; mml.SVGdata.D = this.sd;
|
||||
|
@ -1290,7 +1290,8 @@
|
|||
if (this.mscale) {
|
||||
scale = this.scale;
|
||||
} else {
|
||||
var values = this.getValues("mathsize","scriptlevel","fontsize");
|
||||
var values = this.getValues("scriptlevel","fontsize");
|
||||
values.mathsize = (this.isToken ? this : this.Parent()).Get("mathsize");
|
||||
if ((this.styles||{}).fontSize && !values.fontsize) {values.fontsize = this.styles.fontSize}
|
||||
if (values.fontsize && !this.mathsize) {values.mathsize = values.fontsize}
|
||||
if (values.scriptlevel !== 0) {
|
||||
|
@ -1466,6 +1467,7 @@
|
|||
c = SVG.FONTDATA.DELIMITERS[c.charCodeAt(0)];
|
||||
var can = (c && c.dir == direction.substr(0,1));
|
||||
if (!can) {delete this.svg}
|
||||
this.forceStretch = can && (this.Get("minsize",true) || this.Get("maxsize",true));
|
||||
return can;
|
||||
},
|
||||
SVGstretchV: function (h,d) {
|
||||
|
@ -1564,7 +1566,8 @@
|
|||
var values = this.getValues("height","depth","width");
|
||||
values.mathbackground = this.mathbackground;
|
||||
if (this.background && !this.mathbackground) {values.mathbackground = this.background}
|
||||
var svg = this.SVG(), scale = this.SVGgetScale(svg), mu = this.SVGgetMu(svg);
|
||||
var svg = this.SVG(); this.SVGgetScale(svg);
|
||||
var scale = this.mscale, mu = this.SVGgetMu(svg);
|
||||
svg.h = SVG.length2em(values.height,mu) * scale;
|
||||
svg.d = SVG.length2em(values.depth,mu) * scale;
|
||||
svg.w = svg.r = SVG.length2em(values.width,mu) * scale;
|
||||
|
|
Loading…
Reference in New Issue
Block a user