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-django.min.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-django.min.js')
| -rw-r--r-- | public/prism/prism-django.min.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/public/prism/prism-django.min.js b/public/prism/prism-django.min.js new file mode 100644 index 0000000..05c9801 --- /dev/null +++ b/public/prism/prism-django.min.js @@ -0,0 +1,37 @@ +!(function (e) { + e.languages.django = { + comment: /^\{#[\s\S]*?#\}$/, + tag: { pattern: /(^\{%[+-]?\s*)\w+/, lookbehind: !0, alias: 'keyword' }, + delimiter: { pattern: /^\{[{%][+-]?|[+-]?[}%]\}$/, alias: 'punctuation' }, + string: { pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, greedy: !0 }, + filter: { pattern: /(\|)\w+/, lookbehind: !0, alias: 'function' }, + test: { + pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/, + lookbehind: !0, + alias: 'function', + }, + function: /\b[a-z_]\w+(?=\s*\()/i, + keyword: + /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/, + operator: /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, + number: /\b\d+(?:\.\d+)?\b/, + boolean: /[Ff]alse|[Nn]one|[Tt]rue/, + variable: /\b\w+\b/, + punctuation: /[{}[\](),.:;]/, + }; + var n = /\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}|\{#[\s\S]*?#\}/g, + o = e.languages['markup-templating']; + e.hooks.add('before-tokenize', function (e) { + o.buildPlaceholders(e, 'django', n); + }), + e.hooks.add('after-tokenize', function (e) { + o.tokenizePlaceholders(e, 'django'); + }), + (e.languages.jinja2 = e.languages.django), + e.hooks.add('before-tokenize', function (e) { + o.buildPlaceholders(e, 'jinja2', n); + }), + e.hooks.add('after-tokenize', function (e) { + o.tokenizePlaceholders(e, 'jinja2'); + }); +})(Prism); |
