commit c526b2a5c58ae8e2549303d5649c1364e3085f08 parent 9cefee80f94a123a428e5e5e98859e3cd33f7faf Author: physikerwelt (Moritz Schubotz) <wiki@physikerwelt.de> Date: Tue, 14 Oct 2014 18:34:36 +0200 XML-escape TeX annotation Diffstat:
| M | unpacked/extensions/toMathML.js | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git 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+" <mrow>"); data.push(space+" </mrow>")} data.unshift(space+" <semantics>"); - data.push(space+' <annotation encoding="'+annotation+'">'+jax.originalText+"</annotation>"); + var xmlEscapedTex = jax.originalText.replace(/([&<>])/g, function(item) { + return { '>': '>', '<': '<','&': '&' }[item] + }); + data.push(space+' <annotation encoding="'+annotation+'">'+xmlEscapedTex+"</annotation>"); data.push(space+" </semantics>"); } return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+"</"+tag+">";