diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-10-13 19:32:56 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-11 18:14:41 +0100 |
| commit | 006b15b467a5cd835a6eab1b49023100bdc8f2e6 (patch) | |
| tree | 949c7295c2e206f42357f135bab4696ddf6576ec /public/prism/prism-tt2.min.js | |
| parent | 00f147a7a687d5772bcc538bc606cfff972178cd (diff) | |
refactor(components): rewrite Code component and usePrism hook
* move Prism styles to Sass placeholders to avoid repeats
* let usePrism consumer define its plugins (remove default ones)
* remove `plugins` prop from Code component
* add new props to Code component to let consumer configure plugins
(and handle plugin list from the given options)
However there are some problems with Prism plugins: line-highlight and
treeview does not seems to be loaded. I don't want to use Babel instead
of SWC so I have no solution for now.
Diffstat (limited to 'public/prism/prism-tt2.min.js')
| -rw-r--r-- | public/prism/prism-tt2.min.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/public/prism/prism-tt2.min.js b/public/prism/prism-tt2.min.js index 02a01f8..83b6a7f 100644 --- a/public/prism/prism-tt2.min.js +++ b/public/prism/prism-tt2.min.js @@ -1,18 +1,18 @@ -!(function (t) { - (t.languages.tt2 = t.languages.extend('clike', { +!(function (e) { + (e.languages.tt2 = e.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', { + e.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', { + e.languages.insertBefore('tt2', 'keyword', { delimiter: { pattern: /^(?:\[%|%%)-?|-?%\]$/, alias: 'punctuation' }, }), - t.languages.insertBefore('tt2', 'string', { + e.languages.insertBefore('tt2', 'string', { 'single-quoted-string': { pattern: /'[^\\']*(?:\\[\s\S][^\\']*)*'/, greedy: !0, @@ -27,15 +27,15 @@ }, }, }), - delete t.languages.tt2.string, - t.hooks.add('before-tokenize', function (e) { - t.languages['markup-templating'].buildPlaceholders( - e, + delete e.languages.tt2.string, + e.hooks.add('before-tokenize', function (t) { + e.languages['markup-templating'].buildPlaceholders( + t, 'tt2', /\[%[\s\S]+?%\]/g ); }), - t.hooks.add('after-tokenize', function (e) { - t.languages['markup-templating'].tokenizePlaceholders(e, 'tt2'); + e.hooks.add('after-tokenize', function (t) { + e.languages['markup-templating'].tokenizePlaceholders(t, 'tt2'); }); })(Prism); |
