prism-typoscript.js 2.2 KB

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