You cannot 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
4.8 KiB
Plaintext

(function(){var c=/\blang(?:uage)?-(?!\*)(\w+)\b/i,a=self.Prism={util:{type:function(f){return Object.prototype.toString.call(f).match(/\[object (\w+)\]/)[1]},clone:function(h){var j=a.util.type(h);switch(j){case"Object":var g={};for(var f in h){h.hasOwnProperty(f)&&(g[f]=a.util.clone(h[f]))}return g;case"Array":return h.slice()}return h}},languages:{extend:function(h,j){var g=a.util.clone(a.languages[h]);for(var f in j){g[f]=j[f]}return g},insertBefore:function(l,p,k,h){h=h||a.languages;var j=h[l],m={};for(var g in j){if(j.hasOwnProperty(g)){if(g==p){for(var f in k){k.hasOwnProperty(f)&&(m[f]=k[f])}}m[g]=j[g]}}return h[l]=m},DFS:function(g,h){for(var f in g){h.call(g,f,g[f]);a.util.type(g)==="Object"&&a.languages.DFS(g[f],h)}}},highlightAll:function(j,k){var h=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var f=0,g;g=h[f++];){a.highlightElement(g,j===!0,k)}},highlightElement:function(e,j,q){var g,p,n=e;while(n&&!c.test(n.className)){n=n.parentNode}if(n){g=(n.className.match(c)||[,""])[1];p=a.languages[g]}if(!p){return}e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+g;n=e.parentNode;/pre/i.test(n.nodeName)&&(n.className=n.className.replace(c,"").replace(/\s+/g," ")+" language-"+g);var k=e.textContent;if(!k){return}k=k.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00a0/g," ");var h={element:e,language:g,grammar:p,code:k};a.hooks.run("before-highlight",h);if(j&&self.Worker){var m=new Worker(a.filename);m.onmessage=function(f){h.highlightedCode=d.stringify(JSON.parse(f.data));h.element.innerHTML=h.highlightedCode;q&&q.call(h.element);a.hooks.run("after-highlight",h)};m.postMessage(JSON.stringify({language:h.language,code:h.code}))}else{h.highlightedCode=a.highlight(h.code,h.grammar);h.element.innerHTML=h.highlightedCode;q&&q.call(e);a.hooks.run("after-highlight",h)}},highlight:function(g,f){return d.stringify(a.tokenize(g,f))},tokenize:function(H,A){var w=a.Token,D=[H],t=A.rest;if(t){for(var z in t){A[z]=t[z]}delete A.rest}H:for(var z in A){if(!A.hasOwnProperty(z)||!A[z]){continue}var q=A[z],L=q.inside,G=!!q.lookbehind||0;q=q.pattern||q;for(var C=0;C<D.length;C++){var J=D[C];if(D.length>H.length){break H}if(J instanceof w){continue}q.lastIndex=0;var E=q.exec(J);if(E){G&&(G=E[1].length);var x=E.index-1+G,E=E[0].slice(G),I=E.length,k=x+I,B=J.slice(0,x+1),F=J.slice(k+1),j=[C,1];B&&j.push(B);var K=new w(z,L?a.tokenize(E,L):E);j.push(K);F&&j.push(F);Array.prototype.splice.apply(D,j)}}}return D},hooks:{all:{},add:function(g,h){var f=a.hooks.all;f[g]=f[g]||[];f[g].push(h)},run:function(j,k){var h=a.hooks.all[j];if(!h||!h.length){return}for(var f=0,g;g=h[f++];){g(k)}}}},d=a.Token=function(g,f){this.type=g;this.content=f};d.stringify=function(j){if(typeof j=="string"){return j}if(Object.prototype.toString.call(j)=="[object Array]"){return j.map(d.stringify).join("")}var h={type:j.type,content:d.stringify(j.content),tag:"span",classes:["token",j.type],attributes:{}};h.type=="comment"&&(h.attributes.spellcheck="true");a.hooks.run("wrap",h);var f="";for(var g in h.attributes){f+=g+'="'+(h.attributes[g]||"")+'"'}return"<"+h.tag+' class="'+h.classes.join(" ")+'" '+f+">"+h.content+"</"+h.tag+">"};if(!self.document){self.addEventListener("message",function(h){var j=JSON.parse(h.data),g=j.language,f=j.code;self.postMessage(JSON.stringify(a.tokenize(f,a.languages[g])));self.close()},!1);return}var b=document.getElementsByTagName("script");b=b[b.length-1];if(b){a.filename=b.src;document.addEventListener&&!b.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",a.highlightAll)}})();Prism.languages.markup={comment:/&lt;!--[\w\W]*?--(&gt;|&gt;)/g,prolog:/&lt;\?.+?\?&gt;/,doctype:/&lt;!DOCTYPE.+?&gt;/,cdata:/&lt;!\[CDATA\[[\w\W]+?]]&gt;/i,tag:{pattern:/&lt;\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?&gt;/gi,inside:{tag:{pattern:/^&lt;\/?[\w:-]+/i,inside:{punctuation:/^&lt;\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|&gt;|"/g}},punctuation:/\/?&gt;/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&amp;#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(a){a.type==="entity"&&(a.attributes.title=a.content.replace(/&amp;/,"&"))});Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});