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-ftl.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-ftl.min.js')
| -rw-r--r-- | public/prism/prism-ftl.min.js | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/public/prism/prism-ftl.min.js b/public/prism/prism-ftl.min.js index 2b1df40..8d83cc6 100644 --- a/public/prism/prism-ftl.min.js +++ b/public/prism/prism-ftl.min.js @@ -1,16 +1,16 @@ -!(function (n) { +!(function (e) { for ( - var i = + var t = '[^<()"\']|\\((?:<expr>)*\\)|<(?!#--)|<#--(?:[^-]|-(?!->))*--\x3e|"(?:[^\\\\"]|\\\\.)*"|\'(?:[^\\\\\']|\\\\.)*\'', - e = 0; - e < 2; - e++ + n = 0; + n < 2; + n++ ) - i = i.replace(/<expr>/g, function () { - return i; + t = t.replace(/<expr>/g, function () { + return t; }); - i = i.replace(/<expr>/g, '[^\\s\\S]'); - var t = { + t = t.replace(/<expr>/g, '[^\\s\\S]'); + var i = { comment: /<#--[\s\S]*?-->/, string: [ { pattern: /\br("|')(?:(?!\1)[^\\]|\\.)*\1/, greedy: !0 }, @@ -19,7 +19,7 @@ '("|\')(?:(?!\\1|\\$\\{)[^\\\\]|\\\\.|\\$\\{(?:(?!\\})(?:<expr>))*\\})*\\1'.replace( /<expr>/g, function () { - return i; + return t; } ) ), @@ -30,7 +30,7 @@ '((?:^|[^\\\\])(?:\\\\\\\\)*)\\$\\{(?:(?!\\})(?:<expr>))*\\}'.replace( /<expr>/g, function () { - return i; + return t; } ) ), @@ -59,8 +59,8 @@ /\.\.[<*!]?|->|--|\+\+|&&|\|\||\?{1,2}|[-+*/%!=<>]=?|\b(?:gt|gte|lt|lte)\b/, punctuation: /[,;.:()[\]{}]/, }; - (t.string[1].inside.interpolation.inside.rest = t), - (n.languages.ftl = { + (i.string[1].inside.interpolation.inside.rest = i), + (e.languages.ftl = { 'ftl-comment': { pattern: /^<#--[\s\S]*/, alias: 'comment' }, 'ftl-directive': { pattern: /^<[\s\S]+>$/, @@ -71,30 +71,30 @@ alias: 'keyword', }, punctuation: /^<\/?|\/?>$/, - content: { pattern: /\s*\S[\s\S]*/, alias: 'ftl', inside: t }, + content: { pattern: /\s*\S[\s\S]*/, alias: 'ftl', inside: i }, }, }, 'ftl-interpolation': { pattern: /^\$\{[\s\S]*\}$/, inside: { punctuation: /^\$\{|\}$/, - content: { pattern: /\s*\S[\s\S]*/, alias: 'ftl', inside: t }, + content: { pattern: /\s*\S[\s\S]*/, alias: 'ftl', inside: i }, }, }, }), - n.hooks.add('before-tokenize', function (e) { - var t = RegExp( + e.hooks.add('before-tokenize', function (n) { + var i = RegExp( '<#--[^]*?--\x3e|</?[#@][a-zA-Z](?:<expr>)*?>|\\$\\{(?:<expr>)*?\\}'.replace( /<expr>/g, function () { - return i; + return t; } ), 'gi' ); - n.languages['markup-templating'].buildPlaceholders(e, 'ftl', t); + e.languages['markup-templating'].buildPlaceholders(n, 'ftl', i); }), - n.hooks.add('after-tokenize', function (e) { - n.languages['markup-templating'].tokenizePlaceholders(e, 'ftl'); + e.hooks.add('after-tokenize', function (t) { + e.languages['markup-templating'].tokenizePlaceholders(t, 'ftl'); }); })(Prism); |
