19 lines
4.9 KiB
JavaScript
19 lines
4.9 KiB
JavaScript
/*
|
|
* ../SourceForge/trunk/mathjax/extensions/tex2jax.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([
|
|
['MathJax.Extension.tex2jax','={','config',':{element:null,','inlineMath',':[["$","$"],["\\\\(","\\\\)"]],','displayMath',':[["$$","$$"],["\\\\[","\\\\]"]],skipTags:["script","noscript","style","textarea","pre","code"],','ignoreClass',':"tex2jax_ignore",','processClass',':"tex2jax_process",','processEscapes',':false,','processEnvironments',':true,preview:"TeX"},','PreProcess',':function(','a){if(!','this.configured','){','MathJax.Hub.','Insert(','this.config',',(',21,2,'.tex2jax||{}));if(',23,'.Augment','){',21,'Insert(this,',23,29,')}','if(typeof(',23,'.previewTeX',')!=="undefined"&&!',23,38,'){',23,'.preview','="none"}',19,'=true}',36,'a)==="','string"){a=','document.','getElementById(a)}if(!a){a=',23,'.element||',51,'body}this.','createPatterns','();this.','scanElement','(a,a','.nextSibling',')},',57,':function(){var d=[],c,a,b=',23,';this.match={};','for(c=0,a=b.',4,'.length;c<a;c++){d.push(this.patternQuote(b.',4,'[c][0]));this.match[b.',4,'[c][0]]={mode:"",','end:b.',4,'[c][1],pattern:this.endPattern(b.',4,'[c][1])}}',67,6,69,6,71,6,'[c][0]]={','mode:"; mode=display",',74,6,76,6,78,'this.start','=','new RegExp','(d.sort(this.sortLength).join("|")+(b.',14,'?"|\\\\\\\\begin\\\\{([^}]*)\\\\}":"")+(b.',12,'?"|\\\\\\\\*\\\\\\\\\\\\$":""),"g");this.skipTags=',94,'("^("+b.skipTags.join("|")+")$","i");this.',8,'=new RegExp("(^| )("+b.',8,'+")( |$)");this.',10,103,10,'+")( |$)")},','patternQuote',17,'a){return ','a','.replace','(/([\\^$(){}+*?\\-|\\[\\]\\:\\\\])/g,"\\\\$1")},endPattern',17,112,94,'(this.',110,'(a)+"|\\\\\\\\.","g")},sortLength',17,'d,c){if(d.length!==c.length){return c.length-d.length}return(d==c?0:(d<c?-1:1))},',59,17,'c,b,e){var a,d;while(c&&c!=b){if(c','.nodeName.toLowerCase()==="#','text"){if(!e){c=this.scanText(c)}}else{a','=(typeof(c.','className',')==="undefined"?"":c.',130,');d',129,'tagName',131,135,');',36,'a)!=="',50,'String(a)}if','(c.firstChild','&&!a.match(/(^| )MathJax/)&&!this.skipTags.exec(d)){e=(e||this.',8,'.exec(a))&&!this.',10,'.exec(a);this.',59,143,',b,e)}}if(c){c=c',61,'}}},scanText',17,'b){if(b','.nodeValue',114,'(/\\s+/,"")==""){return b}var a,c;','this.search','={start:true};','this.pattern','=',92,';while(b){','this.pattern.lastIndex','=0;while(b&&b',127,'text"&&(a=',161,'.exec(b',156,'))){if(',159,'.start){b=this.startMatch(a,b)}else{b=this.endMatch(a,b)}}if(',159,'.matched','){','b=this.encloseMath(b',')}if(b){do{c=b;b=b',61,'}while(b&&(b','.nodeName','.toLowerCase()==="br"||b',127,'comment"));if(!b||b',182,'!=="#text"){return c}}}return b},startMatch',17,'b,c){var d=this.match[b[0]];if(d!=null){',159,'={end:d.end,mode:d.mode,','open:c,olen:','b[0].length',',opos:',165,'-',193,'};','this.switchPattern(','d.pattern)}else{if(b[0].substr(0,6)==="\\\\begin"){',159,'={end:"\\\\end{"+b[1]+"}",',86,192,'0,opos:',165,'-',193,',isBeginEnd:true};',199,'this.endPattern(',159,'.end))}else{var a=b[0].replace(/\\\\(.)/g,"$1");c',156,'=c',156,'.substr(','0,b.index)+a+c',156,217,'b.index+',193,');',165,'-=',193,'-a.length}}return c},endMatch',17,'a,b){if(a[0]==',159,'.end){',159,'.close=b;',159,'.cpos=',165,';',159,'.clen=(',159,'.isBeginEnd?0:a[0].length);',159,176,'=true;',178,');',199,92,')}return b},switchPattern',17,'a){a.lastIndex=',165,';',161,'=a;',159,'.start=(a===',92,')},encloseMath',17,'b){var a=',159,',f=a.close,e;if(a.cpos===f.length){f=f',61,'}else{f=f.splitText(a.cpos)}if(!f){e=f=','a.close.parentNode','.appendChild(document.createTextNode','(""))}if(b===a.close){b=f}a.close=f;var c=a.open.splitText(a.opos);while(c',61,'&&c',61,'!==f){if(c',61,156,'!==null){if(c',61,182,'==="#comment"){c',156,'+=c',61,156,114,'(/^\\[CDATA\\[(.*)\\]\\]$/,"$1")}else{c',156,'+=c',61,156,'}}else{c',156,'+=" "}c','.parentNode.removeChild(','c',61,')}var d=c',156,217,'a.olen,c',156,'.length-a.olen-a.clen);c',292,'c);if(',23,44,'!=="none"){this.','createPreview','(a.mode,d',')}c=this.','createMathTag',307,');',159,'={};',165,'=0;if(e){e',292,'e)}return c},insertNode',17,261,159,';if(a.close&&',266,'){',266,'.insertBefore(b,a.','close)}else{if(a.open',61,'){a.open.parentNode',325,'open',61,')}else{a.open.parentNode.appendChild(b)}}},',306,17,'c,a){var b;if(',23,44,'==="TeX"){b=[this.filterTeX(a)]}else{if(',23,44,' instanceof Array){b=',23,44,'}}if(b){b=MathJax.HTML.Element("span",{',130,':',21,2,'.preRemoveClass},b);','this.insertNode(','b)}},',309,17,'c,',261,51,'createElement("script");a.type="math/tex"+c;if(',21,'Browser.isMSIE){a.text=b}else{a',267,'(b))}',350,'a);return a},filterTeX',17,112,'a}};',21,'Register.PreProcessor(["',16,'",',0,']);MathJax.Ajax.loadComplete("[MathJax]/extensions/tex2jax.js");']
|
|
]);
|
|
|