prism-xeora.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. (function (Prism) {
  2. Prism.languages.xeora = Prism.languages.extend('markup', {
  3. 'constant': {
  4. pattern: /\$(?:DomainContents|PageRenderDuration)\$/,
  5. inside: {
  6. 'punctuation': {
  7. pattern: /\$/
  8. }
  9. }
  10. },
  11. 'variable': {
  12. pattern: /\$@?(?:#+|[-+*~=^])?[\w.]+\$/,
  13. inside: {
  14. 'punctuation': {
  15. pattern: /[$.]/
  16. },
  17. 'operator': {
  18. pattern: /#+|[-+*~=^@]/
  19. }
  20. }
  21. },
  22. 'function-inline': {
  23. pattern: /\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,
  24. inside: {
  25. 'variable': {
  26. pattern: /(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,
  27. inside: {
  28. 'punctuation': {
  29. pattern: /[,.|]/
  30. },
  31. 'operator': {
  32. pattern: /#+|[-+*~=^@]/
  33. }
  34. }
  35. },
  36. 'punctuation': {
  37. pattern: /\$\w:|[$:?.,|]/
  38. }
  39. },
  40. alias: 'function'
  41. },
  42. 'function-block': {
  43. pattern: /\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,
  44. inside: {
  45. 'punctuation': {
  46. pattern: /[$:{}?.,|]/
  47. }
  48. },
  49. alias: 'function'
  50. },
  51. 'directive-inline': {
  52. pattern: /\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,
  53. inside: {
  54. 'punctuation': {
  55. pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
  56. inside: {
  57. 'tag': {
  58. pattern: /#\d/
  59. }
  60. }
  61. }
  62. },
  63. alias: 'function'
  64. },
  65. 'directive-block-open': {
  66. pattern: /\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,
  67. inside: {
  68. 'punctuation': {
  69. pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,
  70. inside: {
  71. 'tag': {
  72. pattern: /#\d/
  73. }
  74. }
  75. },
  76. 'attribute': {
  77. pattern: /![A-Z]+$/,
  78. inside: {
  79. 'punctuation': {
  80. pattern: /!/
  81. }
  82. },
  83. alias: 'keyword'
  84. }
  85. },
  86. alias: 'function'
  87. },
  88. 'directive-block-separator': {
  89. pattern: /\}:[-\w.]+:\{/,
  90. inside: {
  91. 'punctuation': {
  92. pattern: /[:{}]/
  93. }
  94. },
  95. alias: 'function'
  96. },
  97. 'directive-block-close': {
  98. pattern: /\}:[-\w.]+\$/,
  99. inside: {
  100. 'punctuation': {
  101. pattern: /[:{}$]/
  102. }
  103. },
  104. alias: 'function'
  105. }
  106. });
  107. Prism.languages.insertBefore('inside', 'punctuation', {
  108. 'variable': Prism.languages.xeora['function-inline'].inside['variable']
  109. }, Prism.languages.xeora['function-block']);
  110. Prism.languages.xeoracube = Prism.languages.xeora;
  111. }(Prism));