1 | (function (Prism) {
|
2 |
|
3 | function createBlock(prefix, inside, contentAlias) {
|
4 | return {
|
5 | pattern: RegExp('<#' + prefix + '[\\s\\S]*?#>'),
|
6 | alias: 'block',
|
7 | inside: {
|
8 | 'delimiter': {
|
9 | pattern: RegExp('^<#' + prefix + '|#>$'),
|
10 | alias: 'important'
|
11 | },
|
12 | 'content': {
|
13 | pattern: /[\s\S]+/,
|
14 | inside: inside,
|
15 | alias: contentAlias
|
16 | }
|
17 | }
|
18 | };
|
19 | }
|
20 |
|
21 | function createT4(insideLang) {
|
22 | var grammar = Prism.languages[insideLang];
|
23 | var className = 'language-' + insideLang;
|
24 |
|
25 | return {
|
26 | 'block': {
|
27 | pattern: /<#[\s\S]+?#>/,
|
28 | inside: {
|
29 | 'directive': createBlock('@', {
|
30 | 'attr-value': {
|
31 | pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,
|
32 | inside: {
|
33 | 'punctuation': /^=|^["']|["']$/
|
34 | }
|
35 | },
|
36 | 'keyword': /\b\w+(?=\s)/,
|
37 | 'attr-name': /\b\w+/
|
38 | }),
|
39 | 'expression': createBlock('=', grammar, className),
|
40 | 'class-feature': createBlock('\\+', grammar, className),
|
41 | 'standard': createBlock('', grammar, className)
|
42 | }
|
43 | }
|
44 | };
|
45 | }
|
46 |
|
47 | Prism.languages['t4-templating'] = Object.defineProperty({}, 'createT4', { value: createT4 });
|
48 |
|
49 | }(Prism));
|