Bug 41677: Protect against tex nodes wrapped in tex nodes.

This gracefully handles: <span class="tex"><span class="tex"
dir="ltr">$ x^2 $</span></span>, generated when you put math tags
inside element attributes.

Change-Id: I997fc5e87b320879c99f7560fb023876ab6ef573
This commit is contained in:
Derk-Jan Hartman 2013-04-28 11:54:20 +02:00
parent f971af901f
commit 6a519421c4
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ MathJax.Extension.wiki2jax = {
if (node.nodeName == 'IMG') {
tex = node.alt;
} else {
tex = node.innerHTML.replace(/^\$/,"").replace(/\$$/,"");
tex = $(node).text().replace(/^\$/,"").replace(/\$$/,"");
tex = tex.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&nbsp;/g," ");
}
@ -69,7 +69,7 @@ MathJax.Extension.wiki2jax = {
createPreview: function (node) {
var preview;
if (this.config.preview === "TeX") {preview = [this.filterPreview(node.innerHTML)]}
if (this.config.preview === "TeX") {preview = [this.filterPreview($(node).text())]}
else if (this.config.preview instanceof Array) {preview = this.config.preview}
if (preview) {
preview = MathJax.HTML.Element("span",{className: MathJax.Hub.config.preRemoveClass},preview);