diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
| commit | a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch) | |
| tree | 542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-tt2.min.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-tt2.min.js')
| -rw-r--r-- | public/prism/prism-tt2.min.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/public/prism/prism-tt2.min.js b/public/prism/prism-tt2.min.js new file mode 100644 index 0000000..02a01f8 --- /dev/null +++ b/public/prism/prism-tt2.min.js @@ -0,0 +1,41 @@ +!(function (t) { + (t.languages.tt2 = t.languages.extend('clike', { + comment: /#.*|\[%#[\s\S]*?%\]/, + keyword: + /\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/, + punctuation: /[[\]{},()]/, + })), + t.languages.insertBefore('tt2', 'number', { + operator: /=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/, + variable: { pattern: /\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i }, + }), + t.languages.insertBefore('tt2', 'keyword', { + delimiter: { pattern: /^(?:\[%|%%)-?|-?%\]$/, alias: 'punctuation' }, + }), + t.languages.insertBefore('tt2', 'string', { + 'single-quoted-string': { + pattern: /'[^\\']*(?:\\[\s\S][^\\']*)*'/, + greedy: !0, + alias: 'string', + }, + 'double-quoted-string': { + pattern: /"[^\\"]*(?:\\[\s\S][^\\"]*)*"/, + greedy: !0, + alias: 'string', + inside: { + variable: { pattern: /\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i }, + }, + }, + }), + delete t.languages.tt2.string, + t.hooks.add('before-tokenize', function (e) { + t.languages['markup-templating'].buildPlaceholders( + e, + 'tt2', + /\[%[\s\S]+?%\]/g + ); + }), + t.hooks.add('after-tokenize', function (e) { + t.languages['markup-templating'].tokenizePlaceholders(e, 'tt2'); + }); +})(Prism); |
