aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-latte.min.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-13 19:32:56 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit006b15b467a5cd835a6eab1b49023100bdc8f2e6 (patch)
tree949c7295c2e206f42357f135bab4696ddf6576ec /public/prism/prism-latte.min.js
parent00f147a7a687d5772bcc538bc606cfff972178cd (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-latte.min.js')
-rw-r--r--public/prism/prism-latte.min.js29
1 files changed, 14 insertions, 15 deletions
diff --git a/public/prism/prism-latte.min.js b/public/prism/prism-latte.min.js
index 2d5a735..2f2f6a7 100644
--- a/public/prism/prism-latte.min.js
+++ b/public/prism/prism-latte.min.js
@@ -1,5 +1,5 @@
-!(function (t) {
- t.languages.latte = {
+!(function (a) {
+ a.languages.latte = {
comment: /^\{\*[\s\S]*/,
'latte-tag': {
pattern: /(^\{(?:\/(?=[a-z]))?)(?:[=_]|[a-z]\w*\b(?!\())/i,
@@ -10,11 +10,11 @@
php: {
pattern: /\S(?:[\s\S]*\S)?/,
alias: 'language-php',
- inside: t.languages.php,
+ inside: a.languages.php,
},
};
- var e = t.languages.extend('markup', {});
- t.languages.insertBefore(
+ var t = a.languages.extend('markup', {});
+ a.languages.insertBefore(
'inside',
'attr-value',
{
@@ -29,25 +29,24 @@
/^=/,
{ pattern: /^(\s*)["']|["']$/, lookbehind: !0 },
],
- php: { pattern: /\S(?:[\s\S]*\S)?/, inside: t.languages.php },
+ php: { pattern: /\S(?:[\s\S]*\S)?/, inside: a.languages.php },
},
},
},
},
},
- e.tag
+ t.tag
),
- t.hooks.add('before-tokenize', function (a) {
- if ('latte' === a.language) {
- t.languages['markup-templating'].buildPlaceholders(
- a,
+ a.hooks.add('before-tokenize', function (e) {
+ 'latte' === e.language &&
+ (a.languages['markup-templating'].buildPlaceholders(
+ e,
'latte',
/\{\*[\s\S]*?\*\}|\{[^'"\s{}*](?:[^"'/{}]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|\/\*(?:[^*]|\*(?!\/))*\*\/)*\}/g
),
- (a.grammar = e);
- }
+ (e.grammar = t));
}),
- t.hooks.add('after-tokenize', function (a) {
- t.languages['markup-templating'].tokenizePlaceholders(a, 'latte');
+ a.hooks.add('after-tokenize', function (t) {
+ a.languages['markup-templating'].tokenizePlaceholders(t, 'latte');
});
})(Prism);