/* * /MathJax/extensions/toMathML.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="2.5.0";var a=MathJax.ElementJax.mml;SETTINGS=MathJax.Hub.config.menuSettings;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.toMathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[],h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f")}}}if(this.isToken||this.isChars){return k+"<"+e+d+">"+j.join("")+""}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+""},toMathMLattributes:function(){var h=(this.type==="mstyle"?a.math.prototype.defaults:this.defaults);var g=(this.attrNames||a.copyAttributeNames),f=a.skipAttributes,k=a.copyAttributes;var d=[];if(this.type==="math"&&(!this.attr||!this.attr.xmlns)){d.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(!this.attrNames){for(var j in h){if(!f[j]&&!k[j]&&h.hasOwnProperty(j)){if(this[j]!=null&&this[j]!==h[j]){if(this.Get(j,null,1)!==this[j]){d.push(j+'="'+this.toMathMLattribute(this[j])+'"')}}}}}for(var e=0,c=g.length;e126||(k<32&&k!==10&&k!==13&&k!==9)){f[g]="&#x"+k.toString(16).toUpperCase()+";"}else{var j={"&":"&","<":"<",">":">",'"':"""}[f[g]];if(j){f[g]=j}}}else{if(g+11);var o=this.type,j=this.toMathMLattributes();var h=[],n=c+(f?" "+(l?" ":""):"")+" ";for(var g=0,e=this.data.length;g")}}if(h.length===0||(h.length===1&&h[0]==="")){if(!f){return"<"+o+j+" />"}h.push(n+"")}if(f){if(l){h.unshift(c+" ");h.push(c+" ")}h.unshift(c+" ");var k=d.originalText.replace(/[&<>]/g,function(i){return{">":">","<":"<","&":"&"}[i]});h.push(c+' '+k+"");h.push(c+" ")}return c+"<"+o+j+">\n"+h.join("\n")+"\n"+c+""}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f\n"+g.join("\n")+"\n"+h+""}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f\n"+g.join("\n")+"\n"+h+""}});a.TeXAtom.Augment({toMathML:function(d){var c=this.toMathMLattributes();if(!c&&this.data[0].data.length===1){return d.substr(2)+this.data[0].toMathML(d)}return d+"\n"+this.data[0].toMathML(d+" ")+"\n"+d+""}});a.chars.Augment({toMathML:function(c){return(c||"")+this.toMathMLquote(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");