1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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);
|