Skip to content

Commit bf115f4

Browse files
authored
Added support for TypoScript (#2505)
1 parent 388ad99 commit bf115f4

14 files changed

+349
-4
lines changed

components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"arduino": {
127127
"title": "Arduino",
128128
"require": "cpp",
129-
"owner": "eisbehr-"
129+
"owner": "dkern"
130130
},
131131
"arff": {
132132
"title": "ARFF",
@@ -1142,6 +1142,14 @@
11421142
"alias": "ts",
11431143
"owner": "vkbansal"
11441144
},
1145+
"typoscript": {
1146+
"title": "TypoScript",
1147+
"alias": "tsconfig",
1148+
"aliasTitles": {
1149+
"tsconfig": "TSConfig"
1150+
},
1151+
"owner": "dkern"
1152+
},
11451153
"unrealscript": {
11461154
"title": "UnrealScript",
11471155
"alias": ["uscript", "uc"],

components/prism-typoscript.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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': /^[0-9]+$/,
57+
'punctuation': /[,|:]/,
58+
}
59+
},
60+
'keyword': keywords,
61+
'number': {
62+
// special highlighting for indexes of arrays in tags
63+
pattern: /[0-9]+\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));

components/prism-typoscript.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-typoscript.html

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<h2>Typical TypoScript Setup File</h2>
2+
<pre><code># import other files
3+
@import 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript'
4+
@import 'EXT:sitepackage/Configuration/TypoScript/Helper/DynamicContent.typoscript'
5+
6+
page = PAGE
7+
page {
8+
typeNum = 0
9+
10+
// setup templates
11+
10 = FLUIDTEMPLATE
12+
10 {
13+
templateName = TEXT
14+
templateName.stdWrap.cObject = CASE
15+
templateName.stdWrap.cObject {
16+
key.data = pagelayout
17+
18+
pagets__sitepackage_default = TEXT
19+
pagets__sitepackage_default.value = Default
20+
21+
pagets__sitepackage_alternate = TEXT
22+
pagets__sitepackage_alternate.value = Alternative
23+
24+
default = TEXT
25+
default.value = Default
26+
}
27+
28+
templateRootPaths {
29+
0 = EXT:sitepackage/Resources/Private/Templates/Page/
30+
1 = {$sitepackage.fluidtemplate.templateRootPath}
31+
}
32+
33+
partialRootPaths {
34+
0 = EXT:sitepackage/Resources/Private/Partials/Page/
35+
1 = {$sitepackage.fluidtemplate.partialRootPath}
36+
}
37+
38+
layoutRootPaths {
39+
0 = EXT:sitepackage/Resources/Private/Layouts/Page/
40+
1 = {$sitepackage.fluidtemplate.layoutRootPath}
41+
}
42+
43+
dataProcessing {
44+
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
45+
10 {
46+
levels = 1
47+
includeSpacer = 1
48+
as = mainnavigation
49+
}
50+
}
51+
}
52+
53+
// include css into head
54+
includeCSS {
55+
bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
56+
bootstrap.external = 1
57+
website = EXT:sitepackage/Resources/Public/Css/styles.css
58+
}
59+
60+
// include js into footer
61+
includeJSFooter {
62+
jquery = https://code.jquery.com/jquery-3.2.1.slim.min.js
63+
jquery.external = 1
64+
bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
65+
bootstrap.external = 1
66+
website = EXT:sitepackage/Resources/Public/JavaScript/scripts.js
67+
}
68+
}
69+
70+
// global site configuration
71+
config {
72+
absRefPrefix = auto
73+
cache_period = 86400
74+
debug = 0
75+
disablePrefixComment = 1
76+
doctype = html5
77+
extTarget =
78+
index_enable = 1
79+
index_externals = 1
80+
index_metatags = 1
81+
inlineStyle2TempFile = 1
82+
intTarget =
83+
linkVars = L
84+
metaCharset = utf-8
85+
no_cache = 0
86+
pageTitleFirst = 1
87+
prefixLocalAnchors = all
88+
removeDefaultJS = 0
89+
sendCacheHeaders = 1
90+
compressCss = 0
91+
compressJs = 0
92+
concatenateCss = 0
93+
concatenateJs = 0
94+
}
95+
</code></pre>

plugins/autoloader/prism-autoloader.js

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
"t4": "t4-cs",
207207
"trig": "turtle",
208208
"ts": "typescript",
209+
"tsconfig": "typoscript",
209210
"uscript": "unrealscript",
210211
"uc": "unrealscript",
211212
"vb": "visual-basic",

plugins/autoloader/prism-autoloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"toml": "TOML",
184184
"trig": "TriG",
185185
"ts": "TypeScript",
186+
"tsconfig": "TSConfig",
186187
"uscript": "UnrealScript",
187188
"uc": "UnrealScript",
188189
"vbnet": "VB.Net",

0 commit comments

Comments
 (0)