UNPKG

2.27 kBJavaScriptView Raw
1(function (Prism) {
2
3 var keywords = /\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;
4
5 Prism.languages.typoscript = {
6 'comment': [
7 {
8 // multiline comments /* */
9 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
10 lookbehind: true
11 },
12 {
13 // double-slash comments - ignored when backslashes or colon is found in front
14 // also ignored whenever directly after an equal-sign, because it would probably be an url without protocol
15 pattern: /(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,
16 lookbehind: true,
17 greedy: true
18 },
19 {
20 // hash comments - ignored when leading quote is found for hex colors in strings
21 pattern: /(^|[^"'])#.*/,
22 lookbehind: true,
23 greedy: true
24 }
25 ],
26 'function': [
27 {
28 // old include style
29 pattern: /<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,
30 inside: {
31 'string': {
32 pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
33 inside: {
34 'keyword': keywords,
35 },
36 },
37 'keyword': {
38 pattern: /INCLUDE_TYPOSCRIPT/,
39 },
40 },
41 },
42 {
43 // new include style
44 pattern: /@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,
45 inside: {
46 'string': /"[^"\r\n]*"|'[^'\r\n]*'/,
47 },
48 }
49 ],
50 'string': {
51 pattern: /^([^=]*=[< ]?)(?:(?!\]\n).)*/,
52 lookbehind: true,
53 inside: {
54 'function': /\{\$.*\}/, // constants include
55 'keyword': keywords,
56 'number': /^\d+$/,
57 'punctuation': /[,|:]/,
58 }
59 },
60 'keyword': keywords,
61 'number': {
62 // special highlighting for indexes of arrays in tags
63 pattern: /\b\d+\s*[.{=]/,
64 inside: {
65 'operator': /[.{=]/,
66 }
67 },
68 'tag': {
69 pattern: /\.?[-\w\\]+\.?/,
70 inside: {
71 'punctuation': /\./,
72 }
73 },
74 'punctuation': /[{}[\];(),.:|]/,
75 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
76 };
77
78 Prism.languages.tsconfig = Prism.languages.typoscript;
79
80}(Prism));