version 1.2, 2006/03/27 19:32:29
|
version 1.3, 2006/05/17 22:19:38
|
Line 145 jsMath.Add(jsMath.tex2math,{
|
Line 145 jsMath.Add(jsMath.tex2math,{
|
if (!element) {element = jsMath.document.body} |
if (!element) {element = jsMath.document.body} |
if (typeof(element) == 'string') {element = jsMath.document.getElementById(element)} |
if (typeof(element) == 'string') {element = jsMath.document.getElementById(element)} |
while (element) { |
while (element) { |
|
if (element.className == null) {element.className = ''} |
if (element.nodeName == '#text') { |
if (element.nodeName == '#text') { |
if (!ignore) {element = this.ScanText(element)} |
if (!ignore) {element = this.ScanText(element)} |
} else if (element.firstChild && element.className != 'math') { |
} else if (element.firstChild && element.className != 'math') { |
Line 170 jsMath.Add(jsMath.tex2math,{
|
Line 171 jsMath.Add(jsMath.tex2math,{
|
this.pattern.lastIndex = 0; |
this.pattern.lastIndex = 0; |
while (element && element.nodeName == '#text' && |
while (element && element.nodeName == '#text' && |
(match = this.pattern.exec(element.nodeValue))) { |
(match = this.pattern.exec(element.nodeValue))) { |
|
this.pattern.match = match; |
element = this.ProcessMatch(match[0],match.index,element); |
element = this.ProcessMatch(match[0],match.index,element); |
} |
} |
if (this.search.matched) {element = this.EncloseMath(element)} |
if (this.search.matched) {element = this.EncloseMath(element)} |
Line 196 jsMath.Add(jsMath.tex2math,{
|
Line 198 jsMath.Add(jsMath.tex2math,{
|
} else { |
} else { |
switch (match) { |
switch (match) { |
case '\\(': |
case '\\(': |
if (this.search.end != '$' && this.search.end != '$$' && |
if (this.search.end == null || |
|
(this.search.end != '$' && this.search.end != '$$') && |
this.processSlashParens) { |
this.processSlashParens) { |
this.ScanMark('span',element,'\\)'); |
this.ScanMark('span',element,'\\)'); |
} |
} |
break; |
break; |
|
|
case '\\[': |
case '\\[': |
if (this.search.end != '$' && this.search.end != '$$' && |
if (this.search.end == null || |
|
(this.search.end != '$' && this.search.end != '$$') && |
this.processSlashBrackets) { |
this.processSlashBrackets) { |
this.ScanMark('div',element,'\\]'); |
this.ScanMark('div',element,'\\]'); |
} |
} |
Line 259 jsMath.Add(jsMath.tex2math,{
|
Line 263 jsMath.Add(jsMath.tex2math,{
|
* for the math element, and the end delimiter we want to find. |
* for the math element, and the end delimiter we want to find. |
*/ |
*/ |
ScanMark: function (type,element,end) { |
ScanMark: function (type,element,end) { |
var len = RegExp.$1.length; |
var len = this.pattern.match[1].length; |
this.search = { |
this.search = { |
type: type, end: end, open: element, olength: len, |
type: type, end: end, open: element, olength: len, |
pos: this.pattern.lastIndex - len |
pos: this.pattern.lastIndex - len |