You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
17 KiB

4 years ago
(function(){var b,a=[].slice;b=(function(){var h,g,e,j,f,d,c;c=function(k){return(k.charAt(0)).toUpperCase()+k.substring(1)};j=function(k){return k.replace(/[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};f=function(t,k,s){var q,o,n,r,p,m;if(t instanceof Array){if(k instanceof Array){for(q=o=0,r=t.length;o<r;q=++o){m=t[q];s=f(m,k[q],s)}}else{for(n=0,p=t.length;n<p;n++){m=t[n];s=f(m,k,s)}}}else{t=j(t);s=s.replace(new RegExp(t,"g"),k)}return s};e=function(k){return k.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};d=function(p,n){var q,m,k,o,l;if(n==null){n=null}if(n!=null){l="";for(m=k=0,o=n.length-1;0<=o?k<=o:k>=o;m=0<=o?++k:--k){q=n[m];q=j(q);l+=q}l="["+l+"]*";return p.replace(new RegExp("^"+l),"").replace(new RegExp(l+"$"),"")}else{return p.replace(/^\s*/,"").replace(/\s*$/,"")}};h=function(n){var q,p,o,m,l;l=[];if(n instanceof Array){for(o=p=0,m=n.length;p<m;o=++p){q=n[o];l.push(o)}}else{for(o in n){l.push(o)}}return l};g=function(m){var p,o,l,k,n;k=[];if(m instanceof Array){for(o=0,l=m.length;o<l;o++){n=m[o];k.push(n)}}else{for(p in m){n=m[p];k.push(n)}}return k};function i(){this.commonWhiteList="kbd|b|i|strong|em|sup|sub|br|code|del|a|hr|small";this.specialWhiteList={table:"table|tbody|thead|tfoot|tr|td|th"};this.hooks={};this.html=false}i.prototype.makeHtml=function(l){var k;this.footnotes=[];this.definitions={};this.holders={};this.uniqid=(Math.ceil(Math.random()*10000000))+(Math.ceil(Math.random()*10000000));this.id=0;l=this.initText(l);k=this.parse(l);k=this.makeFootnotes(k);return this.call("makeHtml",k)};i.prototype.enableHtml=function(k){this.html=k!=null?k:true};i.prototype.hook=function(l,k){if(this.hooks[l]==null){this.hooks[l]=[]}return this.hooks[l].push(k)};i.prototype.makeHolder=function(l){var k;k="|\r"+this.uniqid+this.id+"\r|";this.id+=1;this.holders[k]=l;return k};i.prototype.initText=function(k){return k.replace(/\t/g," ").replace(/\r/g,"")};i.prototype.makeFootnotes=function(l){var k,m;if(this.footnotes.length>0){l+='<div class="footnotes"><hr><ol>';k=1;while(m=this.footnotes.shift()){if(typeof m==="string"){m+=' <a href="#fnref-'+k+'" class="footnote-backref">&#8617;</a>'}else{m[m.length-1]+=' <a href="#fnref-'+k+'" class="footnote-backref">&#8617;</a>';m=m.length>1?this.parse(m.join("\n")):this.parseInline(m[0])}l+='<li id="fn-'+k+'">'+m+"</li>";k+=1}l+="</ol></div>"}return l};i.prototype.parse=function(v){var n,l,o,q,r,p,s,x,k,w,m,t,u;x=[];l=this.parseBlock(v,x);r="";for(p=0,s=l.length;p<s;p++){n=l[p];t=n[0],m=n[1],o=n[2],u=n[3];q=x.slice(m,o+1);k="parse"+c(t);q=this.call("before"+c(k),q,u);w=this[k](q,u);w=this.call("after"+c(k),w,u);r+=w}return r};i.prototype.call=function(){var m,q,l,k,o,n,p;n=arguments[0],m=2<=arguments.length?a.call(arguments,1):[];p=m[0];if(this.hooks[n]==null){return p}o=this.hooks[n];for(l=0,k=o.length;l<k;l++){q=o[l];p=q.apply(this,m);m[0]=p}return p};i.prototype.releaseHolder=function(m,k){var l;if(k==null){k=true}l=0;while((m.indexOf("\r"))>=0&&l<10){m=f(h(this.holders),g(this.holders),m);l+=1}if(k){this.holders={}}return m};i.prototype.parseInline=function(m,l,k,n){if(l==null){l=""}if(k==null){k=true}if(n==null){n=true}m=this.call("beforeParseInline",m);m=m.replace(/(^|[^\\])(`+)(.+?)\2/mg,(function(o){return function(){var p;p=1<=arguments.length?a.call(arguments,0):[];return p[1]+o.makeHolder("<code>"+(e(p[3]))+"</code>")}})(this));m=m.replace(/\\(.)/g,(function(o){return function(){var q,p;p=1<=arguments.length?a.call(arguments,0):[];q=e(p[1]);q=q.replace(/\$/g,"&dollar;");return o.makeHolder(q)}})(this));m=m.replace(/<(https?:\/\/.+)>/ig,(function(o){return function(){var q,r,p;r=1<=arguments.length?a.call(arguments,0):[];p=o.cleanUrl(r[1]);q=o.call("parseLink",r[1]);return o.makeHolder('<a href="'+p+'">'+q+"</a>")}})(this));m=m.replace(/<(\/?)([a-z0-9-]+)(\s+[^>]*)?>/ig,(function(o){return function(){var p;p=1<=arguments.length?a.call(arguments,0):[];if((("|"+o.commonWhiteList+"|"+l+"|").indexOf("|"+p[2].toLowerCase()+"|"))>=0){return o.makeHolder(p[0])}else{return e(p[0])}}})(this));m=f(["<",">"],["&lt;","&gt;"],m);m=