commit 7b5596fd4a8577b9ae87026ca35a4a37dff3865c parent 9cefee80f94a123a428e5e5e98859e3cd33f7faf Author: Davide P. Cervone <dpvc@union.edu> Date: Thu, 20 Nov 2014 08:06:59 -0500 Merge pull request #959 from physikerwelt/TeXML XML-escape TeX annotation (Resolves issue #935) 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+">";