Merge pull request #959 from physikerwelt/TeXML

XML-escape TeX annotation (Resolves issue #935)
This commit is contained in:
Davide P. Cervone 2014-11-20 08:06:59 -05:00
commit 7b5596fd4a

View File

@ -160,7 +160,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
if (annotation) { if (annotation) {
if (nested) {data.unshift(space+" <mrow>"); data.push(space+" </mrow>")} if (nested) {data.unshift(space+" <mrow>"); data.push(space+" </mrow>")}
data.unshift(space+" <semantics>"); data.unshift(space+" <semantics>");
data.push(space+' <annotation encoding="'+annotation+'">'+jax.originalText+"</annotation>"); var xmlEscapedTex = jax.originalText.replace(/([&<>])/g, function(item) {
return { '>': '&gt;', '<': '&lt;','&': '&amp;' }[item]
});
data.push(space+' <annotation encoding="'+annotation+'">'+xmlEscapedTex+"</annotation>");
data.push(space+" </semantics>"); data.push(space+" </semantics>");
} }
return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+"</"+tag+">"; return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+"</"+tag+">";