1 | 'use strict'
|
---|
2 |
|
---|
3 | module.exports = typoscript
|
---|
4 | typoscript.displayName = 'typoscript'
|
---|
5 | typoscript.aliases = ['tsconfig']
|
---|
6 | function typoscript(Prism) {
|
---|
7 | ;(function (Prism) {
|
---|
8 | var keywords =
|
---|
9 | /\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/
|
---|
10 | Prism.languages.typoscript = {
|
---|
11 | comment: [
|
---|
12 | {
|
---|
13 | // multiline comments /* */
|
---|
14 | pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
---|
15 | lookbehind: true
|
---|
16 | },
|
---|
17 | {
|
---|
18 | // double-slash comments - ignored when backslashes or colon is found in front
|
---|
19 | // also ignored whenever directly after an equal-sign, because it would probably be an url without protocol
|
---|
20 | pattern: /(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,
|
---|
21 | lookbehind: true,
|
---|
22 | greedy: true
|
---|
23 | },
|
---|
24 | {
|
---|
25 | // hash comments - ignored when leading quote is found for hex colors in strings
|
---|
26 | pattern: /(^|[^"'])#.*/,
|
---|
27 | lookbehind: true,
|
---|
28 | greedy: true
|
---|
29 | }
|
---|
30 | ],
|
---|
31 | function: [
|
---|
32 | {
|
---|
33 | // old include style
|
---|
34 | pattern:
|
---|
35 | /<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,
|
---|
36 | inside: {
|
---|
37 | string: {
|
---|
38 | pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
|
---|
39 | inside: {
|
---|
40 | keyword: keywords
|
---|
41 | }
|
---|
42 | },
|
---|
43 | keyword: {
|
---|
44 | pattern: /INCLUDE_TYPOSCRIPT/
|
---|
45 | }
|
---|
46 | }
|
---|
47 | },
|
---|
48 | {
|
---|
49 | // new include style
|
---|
50 | pattern: /@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,
|
---|
51 | inside: {
|
---|
52 | string: /"[^"\r\n]*"|'[^'\r\n]*'/
|
---|
53 | }
|
---|
54 | }
|
---|
55 | ],
|
---|
56 | string: {
|
---|
57 | pattern: /^([^=]*=[< ]?)(?:(?!\]\n).)*/,
|
---|
58 | lookbehind: true,
|
---|
59 | inside: {
|
---|
60 | function: /\{\$.*\}/,
|
---|
61 | // constants include
|
---|
62 | keyword: keywords,
|
---|
63 | number: /^\d+$/,
|
---|
64 | punctuation: /[,|:]/
|
---|
65 | }
|
---|
66 | },
|
---|
67 | keyword: keywords,
|
---|
68 | number: {
|
---|
69 | // special highlighting for indexes of arrays in tags
|
---|
70 | pattern: /\b\d+\s*[.{=]/,
|
---|
71 | inside: {
|
---|
72 | operator: /[.{=]/
|
---|
73 | }
|
---|
74 | },
|
---|
75 | tag: {
|
---|
76 | pattern: /\.?[-\w\\]+\.?/,
|
---|
77 | inside: {
|
---|
78 | punctuation: /\./
|
---|
79 | }
|
---|
80 | },
|
---|
81 | punctuation: /[{}[\];(),.:|]/,
|
---|
82 | operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/
|
---|
83 | }
|
---|
84 | Prism.languages.tsconfig = Prism.languages.typoscript
|
---|
85 | })(Prism)
|
---|
86 | }
|
---|