Merge branch 'issue97' into 1.1a-candidate

This commit is contained in:
Davide P. Cervone 2011-05-18 10:11:48 -04:00
commit 90ef4b45eb
8 changed files with 19 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@
*/ */
MathJax.Extension.tex2jax = { MathJax.Extension.tex2jax = {
version: "1.1.2", version: "1.1.3",
config: { config: {
inlineMath: [ // The start/stop pairs for in-line math inlineMath: [ // The start/stop pairs for in-line math
// ['$','$'], // (comment out any you don't want, or add your own, but // ['$','$'], // (comment out any you don't want, or add your own, but
@ -173,10 +173,17 @@ MathJax.Extension.tex2jax = {
}; };
this.switchPattern(this.endPattern(this.search.end)); this.switchPattern(this.endPattern(this.search.end));
} else { // escaped dollar signs } else { // escaped dollar signs
var dollar = match[0].replace(/\\(.)/g,'$1'); // put $ in a span so it doesn't get processed again
element.nodeValue = element.nodeValue.substr(0,match.index) + dollar + // split off backslashes so they don't get removed later
element.nodeValue.substr(match.index + match[0].length); var slashes = match[0].substr(0,match[0].length-1), n, span;
this.pattern.lastIndex -= match[0].length - dollar.length; if (slashes.length % 2 === 0) {span = [slashes.replace(/\\\\/g,"\\")]; n = 1}
else {span = [slashes.substr(1).replace(/\\\\/g,"\\"),"$"]; n = 0}
span = MathJax.HTML.Element("span",null,span);
var text = MathJax.HTML.TextNode(element.nodeValue.substr(0,match.index));
element.nodeValue = element.nodeValue.substr(match.index + match[0].length - n);
element.parentNode.insertBefore(span,element);
element.parentNode.insertBefore(text,span);
this.pattern.lastIndex = n;
} }
return element; return element;
}, },