Updated mathjax extension

This commit is contained in:
benweet 2014-05-02 19:28:41 +01:00
parent 823fdfb4ee
commit 68cce3a472

View File

@ -91,15 +91,21 @@ define([
blocks[i] = "@@" + math.length + "@@"; blocks[i] = "@@" + math.length + "@@";
math.push(block) math.push(block)
} else if(start) { } else if(start) {
// Ignore inline maths that are actually multiline (fixes #136)
if(end == inline && block.charAt(0) == '\n') {
if(last) {
i = last;
processMath(start, i, unescape);
}
start = end = last = null;
braces = 0;
}
// //
// If we are in math, look for the end delimiter, // If we are in math, look for the end delimiter,
// but don't go past double line breaks, and // but don't go past double line breaks, and
// and balance braces within the math. // and balance braces within the math.
// //
if(end == inline && block.charAt(0) == '\n') { else if(block === end) {
// This should fix #136 by ignoring inline maths that are actually multiline
start = end = last = null;
} else if(block === end) {
if(braces) { if(braces) {
last = i last = i
} else { } else {
@ -107,7 +113,12 @@ define([
} }
} else { } else {
if(block.match(/\n.*\n/)) { if(block.match(/\n.*\n/)) {
last && (i = last, processMath(start, i, unescape)), start = end = last = null, braces = 0 if(last) {
i = last;
processMath(start, i, unescape);
}
start = end = last = null;
braces = 0;
} else { } else {
if("{" === block) { if("{" === block) {
braces++ braces++