instiki/public/MathJax/jax/input/MathML/jax.js

19 lines
12 KiB
JavaScript
Raw Normal View History

/*
* ../SourceForge/trunk/mathjax/jax/input/MathML/jax.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* 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.Unpack([
['(','function(','b,c){var a;b.Parse=MathJax.Object.Subclass({Init:',1,'d){this.','Parse(d)},Parse:',1,'f){var g;if(typeof f!=="string"){g=f.parentNode}','else{if(','f.match(/^<[a-z]+:/i)&&!f.match(/^<[^<>]* xmlns:/)){f=f','.replace','(/^<([a-z]+):math/i,\'<$1:math xmlns:$1="http://www.w3.org/1998/Math/MathML"\')}f=f',10,'(/^\\s*(?:\\/\\/)?<!(--)?\\[CDATA\\[((.|\\n)*)(\\/\\/)?\\]\\]\\1>\\s*$/,"$2");f=f','.replace(/&([a-z]+);/ig,this.replaceEntity);','g=b.ParseXML(f);if(g==null','){b.Error("Error parsing MathML','")}}var e','=g.getElementsByTagName("','parsererror")[0];if(e',16,': "+e','.textContent',10,'(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,""))}if(g','.childNodes.length','!==1){','b.Error("MathML must be formed by a',' single element")}if(g','.firstChild','.nodeName','.toLowerCase()==="','html"){var d',18,'h1")[0];if(d&&d',22,'==="XML',' parsing error','"&&','d.nextSibling',16,': "+String(',39,'.nodeValue',').replace(/fatal',37,': /,""))}}if(g',29,'.nodeName.toLowerCase().replace(/^[a-z',']+:/,"")!=="math"){',27,' <math> element, not <"+g',29,30,'+">")}this.mml=this.MakeMML(g',29,')},MakeMML:',1,'h){var g=h',48,']+:/,"");if(!(a[g]&&a[g].isa&&a[g].isa(a.mbase))){return a.merror("Unknown node type: "+g)}var e=a[g](),f,d,j;for(f=0,d=','h.attributes','.length;f<d',';f++){j=',61,'[f].value;if(j',31,'true"){j=true}',8,'j',31,'false"){j=false}}e[',61,'[f].name]=j}for(f=0,d=h',25,';f<d;f++){var l=h.childNodes[f];if(l',30,'==="#comment"){continue}if(l',30,'==="#text"){if(e.isToken){var k=this.trimSpace(l',43,');if(e.isa(a.mo)&&k.length===1&&','this.Remap[k.charAt(0',')]){k=',82,')]}k=k',14,'e.Append(a.chars(k))}',8,'l',43,'.match(/\\S/)){b.Error("Unexpected text node: \'"+l',43,'+"\'")}}}else{e.Append(this.MakeMML(l))}}if(b.config.useMathMLspacing){e.useMMLspacing=8}return e},trimSpace:',1,'d){return',' d',10,'(/^[ \\t\\n\\r]+/,"").','replace(/[ \\t\\n\\r',']+$/,"").',99,'][ \\t\\n\\r]+/g," ")},replaceEntity:',1,'f,e){if(','b.Parse.Entity','[e]){return ',105,'[e]}var g=e.charAt(0).toLowerCase();var d=e.match(/^[a-zA-Z](fr|scr|opf)$/);if(d){g=d[1]}if(!','b.Parse.loaded[g',']){',109,']=true;','MathJax.Hub.','RestartAfter(MathJax.Ajax.Require(b.entityDir+"/"+g+".js"))}return f},Remap:{"\\u0027":"\\u2032","\\u002A":"\\u2217","\\u002D":"\\u2212"}},{loaded:[]});b.Augment({Translate:',1,'d){var e,g;if(d',29,'&&d',29,48,']+:/,"")==="math"){g=this.','prefilterMathML','(d',29,')}else{g=d.innerHTML',10,'(/^\\s+/,"").replace(/\\s+$/,"");if(c.isMSIE){g=g',10,'(/(&nbsp;)+$/,"").','replace(/&','amp;/g,"&").',130,'lt;/g,"&amp;lt;")}',8,'c.isKonqueror){g=g',10,'(/&lt;/g,"<").',130,'gt;/g,">").',130,'amp;/g,"&")}}g=this.prefilterMath(g,d)}try{e=b.Parse(g).mml}catch(f){if(!f.mathmlError){throw f}e=this.formatError(f,g,d)}return a(e)},prefilterMath:',1,'e,',95,' e},',122,':',1,95,' d},formatError:',1,'f,e,',95,' a.merror(f.message',10,'(/\\n.*/,""))},Error:',1,'d){throw ',113,'Insert(Error(d),{mathmlError:true})},parseDOM:',1,95,' ','this.parser','.parseFromString(d,"text/xml")},parseMS:',1,95,'(',164,'.loadXML(d)?',164,':null)},parseDIV:',1,4,'div.innerHTML=d',10,'(/<([a-z]+)([^>]*)\\/>/g,"<$1$2></$1>");return this.div},Startup:function(){a=MathJax.ElementJax.mml;if(window.DOMParser){',164,'=new DOMParser();','this.ParseXML=this.','parseDOM}',8,'window.ActiveXObject){var e=["MSXML2.DOMDocument.6','.0","MSXML2.DOMDocument.','5',184,'4',184,'3',184,'2.0","Microsoft.XMLDOM"];for(var f=0,d=e',62,'&&!',164,';f++){try{',164,'=new ActiveXObject(e[f])}catch(g){}}if(!',164,'){b.Error("Can\'t create XML parser for MathML")}',164,'.async=false;',180,'parseMS}else{this.div=',113,'Insert(document.createElement("div"),{style:{visibility:"hidden",overflow:"hidden",height:"1px",position:"absolute",top:0}});if(!document.body',29,'){document.body.appendChild(this.div)}else{document.body.insertBefore(this.div,document.body',29,')}',180,'parseDIV}}}});',105,'={ApplyFunction:"\\u2061",Backslash:"\\u2216",Because:"\\u2235",Breve:"\\u02D8",Cap:"\\u22D2",CenterDot:"\\u00B7",CircleDot:"\\u2299",CircleMinus:"\\u2296",CirclePlus:"
]);