diff -ur jsMath-2.3b-lowercase/jsMath.js jsMath-2.3b-xhtml/jsMath.js
--- jsMath-2.3b-lowercase/jsMath.js 2005-10-30 11:14:09.000000000 -0800
+++ jsMath-2.3b-xhtml/jsMath.js 2005-10-29 13:58:55.000000000 -0700
@@ -270,14 +270,14 @@
else {document.body.insertBefore(div,document.body.firstChild)}
} catch (err) {
var html = '
';
- if (!document.body.insertAdjacentHTML) {document.write(html)}
+ if (!document.body.insertAdjacentHTML) {jsMath.write(html)}
else {document.body.insertAdjacentHTML('AfterBegin',html)}
div = jsMath.Element(id);
}
@@ -2143,7 +2144,7 @@
*/
Rule: function (w,h) {
if (h == null) {h = jsMath.TeX.default_rule_thickness}
- if (w == 0 || h == 0) return; // should make an invisible box?
+ if (w == 0 || h == 0) return ''; // should make an invisible box?
w *= jsMath.Browser.imgScale;
h = Math.round(h*jsMath.em*jsMath.Browser.imgScale+.25);
if (h < 1) {h = 1};
@@ -2385,7 +2386,7 @@
*/
Rule: function (w,h) {
if (h == null) {h = jsMath.TeX.default_rule_thickness}
- html = jsMath.HTML.Rule(w,h);
+ var html = jsMath.HTML.Rule(w,h);
return new jsMath.Box('html',html,w,h,0);
},
@@ -2410,7 +2411,7 @@
* Return the character, font, style and actual height used.
*/
DelimBestFit: function (H,c,font,style) {
- if (c == 0 && font == 0) return;
+ if (c == 0 && font == 0) return null;
var C; var h; font = jsMath.TeX.fam[font];
var isSS = (style.charAt(1) == 'S');
var isS = (style.charAt(0) == 'S');
@@ -2424,6 +2425,7 @@
if (h >= H || C.n == null) {return [c,font,'T',h]}
c = C.n
}
+ return null;
},
/*
@@ -3066,7 +3068,7 @@
* contains an \over (or \above, etc).
*/
Over: function () {
- var over = this.data.overI; var from = this.data.overF
+ var over = this.data.overI; var from = this.data.overF;
var atom = jsMath.mItem.Fraction(from.name,
{type: 'mlist', mlist: this.Range(open+1,over-1)},
{type: 'mlist', mlist: this.Range(over)},
@@ -4497,7 +4499,7 @@
Process: function (arg) {
var data = this.mlist.data;
arg = jsMath.Parse(arg,data.font,data.size,data.style);
- if (arg.error) {this.Error(arg); return}
+ if (arg.error) {this.Error(arg); return null}
if (arg.mlist.Length() == 0) {return null}
if (arg.mlist.Length() == 1) {
var atom = arg.mlist.Last();
@@ -4515,7 +4517,8 @@
var letter = /^([a-z]+|.) ?/i;
var cmd = letter.exec(this.string.slice(this.i));
if (cmd) {this.i += cmd[1].length; return cmd[1]}
- this.Error("Missing control sequnece name at end of string or argument"); return
+ this.Error("Missing control sequnece name at end of string or argument");
+ return null;
},
/*
@@ -4524,8 +4527,8 @@
*/
GetArgument: function (name,noneOK) {
while (this.nextIsSpace()) {this.i++}
- if (this.i >= this.string.length) {if (!noneOK) this.Error("Missing argument for "+name); return}
- if (this.string.charAt(this.i) == this.close) {if (!noneOK) this.Error("Extra close brace"); return}
+ if (this.i >= this.string.length) {if (!noneOK) this.Error("Missing argument for "+name); return null}
+ if (this.string.charAt(this.i) == this.close) {if (!noneOK) this.Error("Extra close brace"); return null}
if (this.string.charAt(this.i) == this.cmd) {this.i++; return this.cmd+this.GetCommand()}
if (this.string.charAt(this.i) != this.open) {return this.string.charAt(this.i++)}
var j = ++this.i; var pcount = 1; var c = '';
@@ -4534,18 +4537,19 @@
if (c == this.cmd) {this.i++}
else if (c == this.open) {pcount++}
else if (c == this.close) {
- if (pcount == 0) {this.Error("Extra close brace"); return}
+ if (pcount == 0) {this.Error("Extra close brace"); return null}
if (--pcount == 0) {return this.string.slice(j,this.i-1)}
}
}
this.Error("Missing close brace");
+ return null;
},
/*
* Get an argument and process it into an mList
*/
ProcessArg: function (name) {
- var arg = this.GetArgument(name); if (this.error) return;
+ var arg = this.GetArgument(name); if (this.error) return null;
return this.Process(arg);
},
@@ -4557,10 +4561,11 @@
var c = this.string.charAt(this.i);
if (this.i < this.string.length) {
this.i++;
- if (c == this.cmd) {c = '\\'+this.GetCommand(name); if (this.error) return}
+ if (c == this.cmd) {c = '\\'+this.GetCommand(name); if (this.error) return null}
if (this.delimiter[c] != null) {return this.delimiter[c]}
}
this.Error("Missing or unrecognized delimiter for "+name);
+ return null;
},
/*
@@ -4578,7 +4583,7 @@
advance = 1;
}
var match = rest.match(/^\s*([-+]?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|px)/);
- if (!match) {this.Error("Missing dimension or its units for "+name); return}
+ if (!match) {this.Error("Missing dimension or its units for "+name); return null}
if (advance) {
this.i += match[0].length;
if (this.nextIsSpace()) {this.i++}
@@ -4610,7 +4615,7 @@
if (c == '{') {pcount++}
else if (c == '}') {
if (pcount == 0)
- {this.Error("Extra close brace while looking for ']'"); return}
+ {this.Error("Extra close brace while looking for ']'"); return null}
pcount --;
} else if (c == this.cmd) {
this.i++;
@@ -4619,6 +4624,7 @@
}
}
this.Error("Couldn't find closing ']' for argument to "+this.cmd+name);
+ return null;
},
/*
@@ -4632,7 +4638,7 @@
if (c == '{') {pcount++}
else if (c == '}') {
if (pcount == 0)
- {this.Error("Extra close brace while looking for "+this.cmd+token); return}
+ {this.Error("Extra close brace while looking for "+this.cmd+token); return null}
pcount --;
} else if (c == this.cmd) {
// really need separate counter for begin/end
@@ -4655,6 +4661,7 @@
}
}
this.Error("Couldn't find "+this.cmd+token+" for "+name);
+ return null;
},
/*
@@ -4662,7 +4669,7 @@
* process it to get its mlist
*/
ProcessUpto: function (name,token) {
- var arg = this.GetUpto(name,token); if (this.error) return;
+ var arg = this.GetUpto(name,token); if (this.error) return null;
return this.Process(arg);
},
@@ -4672,8 +4679,8 @@
GetEnd: function (env) {
var body = ''; var name = '';
while (name != env) {
- body += this.GetUpto('begin{'+env+'}','end'); if (this.error) return;
- name = this.GetArgument(this.cmd+'end'); if (this.error) return;
+ body += this.GetUpto('begin{'+env+'}','end'); if (this.error) return null;
+ name = this.GetArgument(this.cmd+'end'); if (this.error) return null;
}
return body;
},