mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-29 22:06:54 +01:00
1 line
99 KiB
JavaScript
1 line
99 KiB
JavaScript
|
var hljs=function(){"use strict";function p(e){Object.freeze(e);var t="function"==typeof e;return Object.getOwnPropertyNames(e).forEach(function(n){!Object.hasOwnProperty.call(e,n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||t&&("caller"===n||"callee"===n||"arguments"===n)||Object.isFrozen(e[n])||p(e[n])}),e}class f{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data}ignoreMatch(){this.ignore=!0}}function t(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function e(t,...n){var e={};for(const n in t)e[n]=t[n];return n.forEach(function(t){for(const n in t)e[n]=t[n]}),e}function a(e){return e.nodeName.toLowerCase()}m=Object.freeze({__proto__:null,escapeHTML:t,inherit:e,nodeStream:function(t){var e=[];return function s(o,n){for(var t=o.firstChild;t;t=t.nextSibling)3===t.nodeType?n+=t.nodeValue.length:1===t.nodeType&&(e.push({event:"start",offset:n,node:t}),n=s(t,n),a(t).match(/br|hr|img|input/)||e.push({event:"stop",offset:n,node:t}));return n}(t,0),e},mergeStreams:function(n,s,c){var e,o=0,r="",i=[];function l(){return n.length&&s.length?n[0].offset!==s[0].offset?n[0].offset<s[0].offset?n:s:"start"===s[0].event?n:s:n.length?n:s}function d(e){r+="<"+a(e)+[].map.call(e.attributes,function(e){return" "+e.nodeName+'="'+t(e.value)+'"'}).join("")+">"}function u(e){r+="</"+a(e)+">"}function h(e){("start"===e.event?d:u)(e.node)}for(;n.length||s.length;)if(e=l(),r+=t(c.substring(o,e[0].offset)),o=e[0].offset,e===n){i.reverse().forEach(u);do h(e.splice(0,1)[0]),e=l();while(e===n&&e.length&&e[0].offset===o)i.reverse().forEach(d)}else"start"===e[0].event?i.push(e[0].node):i.pop(),h(e.splice(0,1)[0]);return r+t(c.substr(o))}});const A="</span>",d=e=>!!e.kind;class k{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!d(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){d(e)&&(this.buffer+=A)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class l{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(t){const e={kind:t,children:[]};this.add(e),this.stack.push(e)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(t,e){return"string"==typeof e?t.addText(e):e.children&&(t.openNode(e),e.children.forEach(e=>this._walk(t,e)),t.closeNode(e)),t}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{l._collapse(e)}))}}class E extends l{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(t,n){const e=t.root;e.kind=n,e.sublanguage=!0,this.add(e)}toHTML(){return new k(this,this.options).value()}finalize(){return!0}}function i(e){return e?"string"==typeof e?e:e.source:null}const h="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",n={begin:"\\\\[\\s\\S]",relevance:0},_={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[n]},M={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[n]},g={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},s=function(n,s,o={}){var t=e({className:"comment",begin:n,end:s,contains:[]},o);return t.contains.push(g),t.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),t},b=s("//","$"),j=s("/\\*","\\*/"),y=s("#","$");var m,o=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:h,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%
|