From c526b2a5c58ae8e2549303d5649c1364e3085f08 Mon Sep 17 00:00:00 2001 From: "physikerwelt (Moritz Schubotz)" Date: Tue, 14 Oct 2014 18:34:36 +0200 Subject: [PATCH] XML-escape TeX annotation --- unpacked/extensions/toMathML.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js index aae34f73a..8ea82e383 100644 --- a/unpacked/extensions/toMathML.js +++ b/unpacked/extensions/toMathML.js @@ -160,7 +160,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () { if (annotation) { if (nested) {data.unshift(space+" "); data.push(space+" ")} data.unshift(space+" "); - data.push(space+' '+jax.originalText+""); + var xmlEscapedTex = jax.originalText.replace(/([&<>])/g, function(item) { + return { '>': '>', '<': '<','&': '&' }[item] + }); + data.push(space+' '+xmlEscapedTex+""); data.push(space+" "); } return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+"";