/* * /MathJax/extensions/mml2jax.js * * Copyright (c) 2009-2013 The MathJax Consortium * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */MathJax.Extension.mml2jax={version:"2.2",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(a){this.configured||(this.config=MathJax.Hub.CombineConfig("mml2jax",this.config),this.config.Augment&&MathJax.Hub.Insert(this,this.config.Augment),this.InitBrowser(),this.configured=!0);"string"===typeof a&&(a=document.getElementById(a));a||(a=document.body);this.ProcessMathArray(a.getElementsByTagName("math"));a.getElementsByTagNameNS&&this.ProcessMathArray(a.getElementsByTagNameNS(this.MMLnamespace,"math"));var b,c;if("undefined"!==typeof document.namespaces)try{for(b=0,c=document.namespaces.length;b/i,"").replace(/<\?xml:namespace .*?\/>/i,""),d=d.replace(/ /g,"\x26#xA0;"));MathJax.HTML.setScript(c,d);b.removeChild(a)}else b=MathJax.HTML.Element("span"),b.appendChild(a),MathJax.HTML.setScript(c,b.innerHTML);"none"!==this.config.preview&&this.createPreview(a,c)},ProcessMathFlattened:function(a){var b=a.parentNode,c=document.createElement("script");c.type="math/mml";b.insertBefore(c,a);for(var b="",d,e=a;a&&"/MATH"!==a.nodeName;)d=a,a=a.nextSibling,b+=this.NodeHTML(d),d.parentNode.removeChild(d);a&&"/MATH"===a.nodeName&&a.parentNode.removeChild(a);c.text=b+"\x3c/math\x3e";"none"!==this.config.preview&&this.createPreview(e,c)},NodeHTML:function(a){var b,c,d;if("#text"===a.nodeName)b=this.quoteHTML(a.nodeValue);else if("#comment"===a.nodeName)b="\x3c!--"+a.nodeValue+"--\x3e";else{b="\x3c"+a.nodeName.toLowerCase();c=0;for(d=a.attributes.length;c|\/>)$/)){c=0;for(d=a.childNodes.length;c/g,"\x26gt;").replace(/\"/g,"\x26quot;")},createPreview:function(a,b){var c=this.config.preview;"none"!==c&&("alttext"===c&&(c=a.getAttribute("alttext"),c=null!=c?[this.filterPreview(c)]:null),c&&(c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c),b.parentNode.insertBefore(c,b)))},filterPreview:function(a){return a},InitBrowser:function(){var a=MathJax.HTML.Element("span",{id:"\x3c",className:"mathjax",innerHTML:"\x3cmath\x3e\x3cmi\x3ex\x3c/mi\x3e\x3cmspace /\x3e\x3c/math\x3e"}),b=a.outerHTML||"";this.AttributeBug=""!==b&&!(b.match(/id="<"/)&&b.match(/class="mathjax"/)&&b.match(/<\/math>/));this.MathTagBug=1