(bug 36855) escape literal % in tex input

This removes support for MathML % comments, just as with texvc

PS2: Fix for regex lookbehind issue

Change-Id: I0cb026d749733ed3dbba8faacb163be4438fc6bb
This commit is contained in:
Derk-Jan Hartman 2012-09-07 14:56:35 +02:00
parent 7b2b7301e0
commit 7e58acc95a

View file

@ -39,6 +39,9 @@ MathJax.Extension.wiki2jax = {
tex = tex.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&nbsp;/g," ");
}
// We don't allow comments (%) in texvc and escape all literal % by default.
tex = tex.replace(/([^\\])%/g, "$1\\%" );
tex = tex.replace(/\\iiint([^!]*)!\\!\\!\\!\\!.*\\subset\\!\\supset/g,"\\iiint$1mkern-2.5em\\subset\\!\\supset").replace(/\\iint([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\subset\\!\\supset/g,"\\iint$1mkern-1.65em$2\\subset\\!\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!.*\\bigcirc(\\,)*/g,"\\iiint$3mkern-2.5em\\subset\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\bigcirc(\\,)*/g,"\\iint$2mkern-1.65em$3\\subset\\!\\!\\supset");
if (mode === "") {
tex = tex.replace(/ *\\scriptstyle(\W)/g,"\\textstyle$1").replace(/ *\\scriptscriptstyle(\W)/g,"\\scriptstyle$1");