Locally add prismjs
This commit is contained in:
parent
35af792c6a
commit
6aa044cf9b
701 changed files with 35787 additions and 0 deletions
53
node_modules/prismjs/components/prism-tt2.js
generated
vendored
Normal file
53
node_modules/prismjs/components/prism-tt2.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
(function (Prism) {
|
||||
|
||||
Prism.languages.tt2 = Prism.languages.extend('clike', {
|
||||
'comment': /#.*|\[%#[\s\S]*?%\]/,
|
||||
'keyword': /\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/,
|
||||
'punctuation': /[[\]{},()]/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('tt2', 'number', {
|
||||
'operator': /=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/,
|
||||
'variable': {
|
||||
pattern: /\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('tt2', 'keyword', {
|
||||
'delimiter': {
|
||||
pattern: /^(?:\[%|%%)-?|-?%\]$/,
|
||||
alias: 'punctuation'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('tt2', 'string', {
|
||||
'single-quoted-string': {
|
||||
pattern: /'[^\\']*(?:\\[\s\S][^\\']*)*'/,
|
||||
greedy: true,
|
||||
alias: 'string'
|
||||
},
|
||||
'double-quoted-string': {
|
||||
pattern: /"[^\\"]*(?:\\[\s\S][^\\"]*)*"/,
|
||||
greedy: true,
|
||||
alias: 'string',
|
||||
inside: {
|
||||
'variable': {
|
||||
pattern: /\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The different types of TT2 strings "replace" the C-like standard string
|
||||
delete Prism.languages.tt2.string;
|
||||
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var tt2Pattern = /\[%[\s\S]+?%\]/g;
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'tt2', tt2Pattern);
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'tt2');
|
||||
});
|
||||
|
||||
}(Prism));
|
Loading…
Add table
Add a link
Reference in a new issue