mirror of
https://github.com/Xcnte/Code-Prettify-for-typecho.git
synced 2024-12-21 20:30:22 +08:00
Update prism.js
This commit is contained in:
parent
9eaf9a9511
commit
1e7770329e
@ -89,7 +89,7 @@ c.textContent=b);return c}});Prism.hooks.add("complete",k)}})();
|
||||
function(e){var c=e.element.parentNode;if(c&&/pre/i.test(c.nodeName)&&(e=c.getAttribute("data-language")||b[e.language]||e.language&&e.language.substring(0,1).toUpperCase()+e.language.substring(1)))return c=document.createElement("span"),c.textContent=e,c})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")})();
|
||||
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,
|
||||
function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
||||
Prism.languages.golang=Prism.languages.extend("clike",{keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,builtin:/\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,boolean:/\b(?:_|iota|nil|true|false)\b/,operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
||||
Prism.languages.go=Prism.languages.extend("clike",{keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,builtin:/\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,boolean:/\b(?:_|iota|nil|true|false)\b/,operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
||||
number:/(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,string:{pattern:/(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0}});delete Prism.languages.go["class-name"];
|
||||
(function(){if("undefined"!==typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var b=window.ClipboardJS||void 0;b||"function"!==typeof require||(b=require("clipboard"));var e=[];if(!b){var c=document.createElement("script"),d=document.querySelector("head");c.onload=function(){if(b=window.ClipboardJS)for(;e.length;)e.pop()()};c.src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js";d.appendChild(c)}Prism.plugins.toolbar.registerButton("copy-to-clipboard",function(c){function a(){var a=
|
||||
new b(g,{text:function(){return c.code}});a.on("success",function(){g.innerHTML='<i class="fontello fontello-tags" id="btn-copy-code"style="font-style:normal;"> \u5df2\u590d\u5236</i>';d()});a.on("error",function(){g.textContent="Press Ctrl+C to copy";d()})}function d(){setTimeout(function(){g.innerHTML='<i class="fontello fontello-tags" id="btn-copy-code"style="font-style:normal;"> \u590d\u5236</i>'},5E3)}var g=document.createElement("button");g.innerHTML='<i class="fontello fontello-tags" id="btn-copy-code"style="font-style:normal;"> \u590d\u5236</i>';
|
||||
|
Loading…
Reference in New Issue
Block a user