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
1.6 KiB
JavaScript

!function(e){var t=/\{\*[\w\W]+?\*\}|\{[\w\W]+?\}/g,a="{literal}",n="{/literal}",o=!1;e.languages.smarty=e.languages.extend("markup",{smarty:{pattern:t,inside:{delimiter:{pattern:/^\{|\}$/gi,alias:"punctuation"},string:/(["'])(\\?.)*?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,variable:[/\$(?!\d)\w+/g,/#(?!\d)\w+#/g,{pattern:/(\.|->)(?!\d)\w+/g,lookbehind:!0},{pattern:/(\[)(?!\d)\w+(?=\])/g,lookbehind:!0}],"function":[{pattern:/(\|\s*)@?(?!\d)\w+/,lookbehind:!0},/^\/?(?!\d)\w+/g,/(?!\d)\w+(?=\()/g],"attr-name":{pattern:/\w+\s*=\s*(?:(?!\d)\w+)?/g,inside:{variable:{pattern:/(=\s*)(?!\d)\w+/g,lookbehind:!0},punctuation:/=/g}},punctuation:/[\[\]().,=\|:`]|\->/g,operator:[/[+\-*\/%]|===?|[!<>]=?|&&|\|\|/g,/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,/\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g],keyword:/\b(?:false|off|on|no|true|yes)\b/g}}}),e.languages.insertBefore("smarty","tag",{"smarty-comment":{pattern:/\{\*[\w\W]*?\*\}/g,alias:["smarty","comment"]}}),e.hooks.add("before-highlight",function(e){"smarty"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(t,function(t){return t===n&&(o=!1),o?t:(t===a&&(o=!0),e.tokenStack.push(t),"___SMARTY"+e.tokenStack.length+"___")}))}),e.hooks.add("before-insert",function(e){"smarty"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(t){if("smarty"===t.language){for(var a,n=0;a=t.tokenStack[n];n++)t.highlightedCode=t.highlightedCode.replace("___SMARTY"+(n+1)+"___",e.highlight(a,t.grammar,"smarty"));t.element.innerHTML=t.highlightedCode}})}(Prism);