main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 |
|
---|
| 3 | Prism.languages.handlebars = {
|
---|
| 4 | 'comment': /\{\{![\s\S]*?\}\}/,
|
---|
| 5 | 'delimiter': {
|
---|
| 6 | pattern: /^\{\{\{?|\}\}\}?$/,
|
---|
| 7 | alias: 'punctuation'
|
---|
| 8 | },
|
---|
| 9 | 'string': /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
---|
| 10 | 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
|
---|
| 11 | 'boolean': /\b(?:false|true)\b/,
|
---|
| 12 | 'block': {
|
---|
| 13 | pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,
|
---|
| 14 | lookbehind: true,
|
---|
| 15 | alias: 'keyword'
|
---|
| 16 | },
|
---|
| 17 | 'brackets': {
|
---|
| 18 | pattern: /\[[^\]]+\]/,
|
---|
| 19 | inside: {
|
---|
| 20 | punctuation: /\[|\]/,
|
---|
| 21 | variable: /[\s\S]+/
|
---|
| 22 | }
|
---|
| 23 | },
|
---|
| 24 | 'punctuation': /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
|
---|
| 25 | 'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
|
---|
| 26 | };
|
---|
| 27 |
|
---|
| 28 | Prism.hooks.add('before-tokenize', function (env) {
|
---|
| 29 | var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
|
---|
| 30 | Prism.languages['markup-templating'].buildPlaceholders(env, 'handlebars', handlebarsPattern);
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | Prism.hooks.add('after-tokenize', function (env) {
|
---|
| 34 | Prism.languages['markup-templating'].tokenizePlaceholders(env, 'handlebars');
|
---|
| 35 | });
|
---|
| 36 |
|
---|
| 37 | Prism.languages.hbs = Prism.languages.handlebars;
|
---|
| 38 | Prism.languages.mustache = Prism.languages.handlebars;
|
---|
| 39 |
|
---|
| 40 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.