You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
7.0 KiB

4 years ago
  1. scopeName: 'source.riot'
  2. name: 'HTML (Riotjs)'
  3. fileTypes: [
  4. 'riot'
  5. ]
  6. patterns: [
  7. # HTML -------------------------------
  8. {
  9. name: 'meta.tag.any.html'
  10. begin: '(</?)([a-zA-Z0-9_-]+)'
  11. beginCaptures:
  12. '1':
  13. name: 'punctuation.definition.tag.begin.html'
  14. '2':
  15. name: 'entity.name.tag.any.html'
  16. end: '>'
  17. endCaptures:
  18. '0':
  19. name: 'punctuation.definition.tag.end.html'
  20. patterns: [
  21. { 'include': '#riotExpressions' }
  22. { 'include': '#tagStuff' }
  23. ]
  24. }
  25. # ------------------------------- HTML
  26. # Script -------------------------------
  27. {
  28. name: "source.js.embedded.html"
  29. begin: "(?:^\\s+)?(<)((?i:script))\\b(?![^>]*/>|lang=[\"'].*[\"'])"
  30. beginCaptures:
  31. "1":
  32. name: "punctuation.definition.tag.html"
  33. "2":
  34. name: "entity.name.tag.script.html"
  35. end: "(?<=</(script|SCRIPT))(>)(?:\\s*\\n)?"
  36. endCaptures:
  37. "2":
  38. name: "punctuation.definition.tag.html"
  39. patterns: [
  40. {
  41. include: "#tag-stuff"
  42. }
  43. {
  44. begin: "(?<!</(?:script|SCRIPT))(>)"
  45. end: "(</)((?i:script))"
  46. captures:
  47. "1":
  48. name: "punctuation.definition.tag.html"
  49. "2":
  50. name: "entity.name.tag.script.html"
  51. patterns: [
  52. {
  53. name: "comment.line.double-slash.js"
  54. begin: "//"
  55. end: "$|(?=</script)"
  56. captures:
  57. "1":
  58. name: "punctuation.definition.comment.js"
  59. }
  60. {
  61. name: "comment.block.js"
  62. begin: "/\\*"
  63. end: "\\*/|(?=</script)"
  64. captures:
  65. "0":
  66. name: "punctuation.definition.comment.js"
  67. }
  68. {
  69. include: "source.js"
  70. }
  71. ]
  72. }
  73. ]
  74. }
  75. # ------------------------------- Script
  76. # Style ------------------------------
  77. # Pure CSS
  78. {
  79. contentName: 'source.css.embedded.html'
  80. begin: '(?:^\\s+)?(<)(style)\\b(?![^>]*(?:(?:/>)|(?:type="(?:text/)?(?:sass|scss)")))'
  81. end: '(</)(style)(>)(?:\\s*\\n)?'
  82. captures:
  83. '1':
  84. name: 'punctuation.definition.tag.begin.html'
  85. '2':
  86. name: 'entity.name.tag.style.html'
  87. '3':
  88. name: 'punctuation.definition.tag.end.html'
  89. patterns: [
  90. { include: '#tagStuff' }
  91. {
  92. begin: '(>)'
  93. end: '(?=</style)'
  94. patterns: [
  95. { include: 'source.css' }
  96. ]
  97. }
  98. ]
  99. }
  100. # Sass
  101. {
  102. contentName: 'source.sass.embedded.html'
  103. begin: '(?:^\\s+)?(<)(style)\\b(?=[^>]*type="(?:text/)?sass")'
  104. end: '(</)(style)(>)(?:\\s*\\n)?'
  105. captures:
  106. '1':
  107. name: 'punctuation.definition.tag.begin.html'
  108. '2':
  109. name: 'entity.name.tag.style.html'
  110. '3':
  111. name: 'punctuation.definition.tag.end.html'
  112. patterns: [
  113. { include: '#tagStuff' }
  114. {
  115. begin: '(>)'
  116. end: '(?=</style)'
  117. patterns: [
  118. { include: 'source.sass' }
  119. ]
  120. }
  121. ]
  122. }
  123. # Scss
  124. {
  125. contentName: 'source.css.scss.embedded.html'
  126. begin: '(?:^\\s+)?(<)(style)\\b(?=[^>]*type="(?:text/)?scss")'
  127. end: '(</)(style)(>)(?:\\s*\\n)?'
  128. captures:
  129. '1':
  130. name: 'punctuation.definition.tag.begin.html'
  131. '2':
  132. name: 'entity.name.tag.style.html'
  133. '3':
  134. name: 'punctuation.definition.tag.end.html'
  135. patterns: [
  136. { include: '#tagStuff' }
  137. {
  138. begin: '(>)'
  139. end: '(?=</style)'
  140. patterns: [
  141. { include: 'source.css.scss' }
  142. ]
  143. }
  144. ]
  145. }
  146. # ------------------------------ Style
  147. # include ----------------------------
  148. { include: 'text.html.basic' }
  149. # ------------------------------------
  150. ]
  151. repository:
  152. riotExpressions:
  153. name: 'meta.string.expression.riot'
  154. begin: '\\{'
  155. beginCaptures:
  156. '0':
  157. name: 'punctuation.definition.block.begin.riot'
  158. end: '\\}'
  159. endCaptures:
  160. '0':
  161. name: 'punctuation.definition.block.end.riot'
  162. contentName: 'source.js'
  163. stringDoubleQuoted:
  164. name: 'string.quoted.double.html'
  165. begin: '"'
  166. beginCaptures:
  167. '0':
  168. name: 'punctuation.definition.string.begin.html'
  169. end: '"'
  170. endCaptures:
  171. '0':
  172. name: 'punctuation.definition.string.end.html'
  173. stringSingleQuoted:
  174. name: 'string.quoted.single.html'
  175. begin: '\''
  176. beginCaptures:
  177. '0':
  178. name: 'punctuation.definition.string.begin.html'
  179. end: '\''
  180. endCaptures:
  181. '0':
  182. name: 'punctuation.definition.string.end.html'
  183. tagGenericAttribute:
  184. name: 'entity.other.attribute-name.html'
  185. match: '\\b([a-zA-Z-]+)'
  186. tagIdAttribute:
  187. name: 'meta.attribute-with-value.id.html'
  188. begin: '\\b(id)\\b\\s*(=)'
  189. captures:
  190. '1':
  191. name: 'entity.other.attribute-name.id.html'
  192. '2':
  193. name: 'punctuation.separator.key-value.html'
  194. end: '(?<=\'|")|(?=\\s|>)'
  195. patterns: [
  196. {
  197. name: 'string.quoted.double.html'
  198. contentName: 'meta.toc-list.id.html'
  199. begin: '"'
  200. beginCaptures:
  201. '0':
  202. name: 'punctuation.definition.string.begin.html'
  203. end: '"'
  204. endCaptures:
  205. '0':
  206. name: 'punctuation.definition.string.end.html'
  207. }
  208. {
  209. name: 'string.quoted.single.html'
  210. contentName: 'meta.toc-list.id.html'
  211. begin: '\''
  212. beginCaptures:
  213. '0':
  214. name: 'punctuation.definition.string.begin.html'
  215. end: '\''
  216. endCaptures:
  217. '0':
  218. name: 'punctuation.definition.string.end.html'
  219. }
  220. ]
  221. tagStuff:
  222. patterns: [
  223. { include: '#tagIdAttribute' }
  224. { include: '#tagGenericAttribute' }
  225. { include: '#stringDoubleQuoted' }
  226. { include: '#stringSingleQuoted' }
  227. ]