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-smarty.min.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-smarty.min.js')
| -rw-r--r-- | public/prism/prism-smarty.min.js | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/public/prism/prism-smarty.min.js b/public/prism/prism-smarty.min.js new file mode 100644 index 0000000..8c85b65 --- /dev/null +++ b/public/prism/prism-smarty.min.js @@ -0,0 +1,94 @@ +!(function (t) { + (t.languages.smarty = { + comment: { pattern: /^\{\*[\s\S]*?\*\}/, greedy: !0 }, + 'embedded-php': { + pattern: /^\{php\}[\s\S]*?\{\/php\}/, + greedy: !0, + inside: { + smarty: { pattern: /^\{php\}|\{\/php\}$/, inside: null }, + php: { + pattern: /[\s\S]+/, + alias: 'language-php', + inside: t.languages.php, + }, + }, + }, + string: [ + { + pattern: /"(?:\\.|[^"\\\r\n])*"/, + greedy: !0, + inside: { + interpolation: { + pattern: /\{[^{}]*\}|`[^`]*`/, + inside: { + 'interpolation-punctuation': { + pattern: /^[{`]|[`}]$/, + alias: 'punctuation', + }, + expression: { pattern: /[\s\S]+/, inside: null }, + }, + }, + variable: /\$\w+/, + }, + }, + { pattern: /'(?:\\.|[^'\\\r\n])*'/, greedy: !0 }, + ], + keyword: { + pattern: /(^\{\/?)[a-z_]\w*\b(?!\()/i, + lookbehind: !0, + greedy: !0, + }, + delimiter: { pattern: /^\{\/?|\}$/, greedy: !0, alias: 'punctuation' }, + number: /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/, + variable: [ + /\$(?!\d)\w+/, + /#(?!\d)\w+#/, + { pattern: /(\.|->|\w\s*=)(?!\d)\w+\b(?!\()/, lookbehind: !0 }, + { pattern: /(\[)(?!\d)\w+(?=\])/, lookbehind: !0 }, + ], + function: { + pattern: /(\|\s*)@?[a-z_]\w*|\b[a-z_]\w*(?=\()/i, + lookbehind: !0, + }, + 'attr-name': /\b[a-z_]\w*(?=\s*=)/i, + boolean: /\b(?:false|no|off|on|true|yes)\b/, + punctuation: /[\[\](){}.,:`]|->/, + operator: [ + /[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/, + /\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/, + /\b(?:and|eq|gt?e|gt|lt?e|lt|mod|neq?|not|or)\b/, + ], + }), + (t.languages.smarty['embedded-php'].inside.smarty.inside = + t.languages.smarty), + (t.languages.smarty.string[0].inside.interpolation.inside.expression.inside = + t.languages.smarty); + var e = /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/, + a = RegExp( + '\\{\\*[^]*?\\*\\}|\\{php\\}[^]*?\\{/php\\}|' + + '\\{(?:[^{}"\']|<str>|\\{(?:[^{}"\']|<str>|\\{(?:[^{}"\']|<str>)*\\})*\\})*\\}'.replace( + /<str>/g, + function () { + return e.source; + } + ), + 'g' + ); + t.hooks.add('before-tokenize', function (e) { + var n = !1; + t.languages['markup-templating'].buildPlaceholders( + e, + 'smarty', + a, + function (e) { + return ( + '{/literal}' === e && (n = !1), + !n && ('{literal}' === e && (n = !0), !0) + ); + } + ); + }), + t.hooks.add('after-tokenize', function (e) { + t.languages['markup-templating'].tokenizePlaceholders(e, 'smarty'); + }); +})(Prism); |
