|
| 1 | +%YAML 1.2 |
| 2 | +--- |
| 3 | +# http://www.sublimetext.com/docs/syntax.html |
| 4 | +name: HTML (CoffeeScript) |
| 5 | +scope: text.html.coffee |
| 6 | +version: 2 |
| 7 | + |
| 8 | +extends: Packages/HTML/HTML.sublime-syntax |
| 9 | + |
| 10 | +file_extensions: |
| 11 | + - coffee.html |
| 12 | + |
| 13 | +contexts: |
| 14 | + |
| 15 | + script-common: |
| 16 | + - meta_prepend: true |
| 17 | + - match: (?i:lang){{attribute_name_break}} |
| 18 | + scope: meta.attribute-with-value.html entity.other.attribute-name.html |
| 19 | + set: script-lang-attribute-assignment |
| 20 | + |
| 21 | + script-lang-attribute-assignment: |
| 22 | + - meta_content_scope: meta.tag.script.begin.html meta.attribute-with-value.html |
| 23 | + - match: = |
| 24 | + scope: punctuation.separator.key-value.html |
| 25 | + set: script-lang-attribute-value |
| 26 | + - match: (?=\S) |
| 27 | + set: script-javascript |
| 28 | + |
| 29 | + script-lang-attribute-value: |
| 30 | + - meta_include_prototype: false |
| 31 | + - meta_scope: meta.tag.script.begin.html meta.attribute-with-value.html |
| 32 | + - match: (?=(?i:coffee{{unquoted_attribute_break}}|'coffee'|"coffee")) |
| 33 | + set: |
| 34 | + - script-coffee |
| 35 | + - tag-generic-attribute-meta |
| 36 | + - tag-generic-attribute-value |
| 37 | + - match: (?=\S) |
| 38 | + set: |
| 39 | + - script-javascript |
| 40 | + - tag-generic-attribute-meta |
| 41 | + - tag-generic-attribute-value |
| 42 | + |
| 43 | + script-type-decider: |
| 44 | + - meta_prepend: true |
| 45 | + - match: (?={{coffee_mime_type}}{{unquoted_attribute_break}}|'{{coffee_mime_type}}'|"{{coffee_mime_type}}") |
| 46 | + set: |
| 47 | + - script-coffee |
| 48 | + - tag-generic-attribute-meta |
| 49 | + - tag-generic-attribute-value |
| 50 | + |
| 51 | + script-coffee: |
| 52 | + - meta_include_prototype: false |
| 53 | + - meta_scope: meta.tag.script.begin.html |
| 54 | + - match: '>' |
| 55 | + scope: punctuation.definition.tag.end.html |
| 56 | + set: script-coffee-content |
| 57 | + - include: script-common |
| 58 | + |
| 59 | + script-coffee-content: |
| 60 | + - meta_include_prototype: false |
| 61 | + - match: \s*((<!\[)(CDATA)(\[)) |
| 62 | + captures: |
| 63 | + 1: meta.tag.sgml.cdata.html |
| 64 | + 2: punctuation.definition.tag.begin.html |
| 65 | + 3: keyword.declaration.cdata.html |
| 66 | + 4: punctuation.definition.tag.begin.html |
| 67 | + pop: 1 # make sure to match only once |
| 68 | + embed: scope:source.coffee |
| 69 | + embed_scope: meta.tag.sgml.cdata.html source.coffee.embedded.html |
| 70 | + escape: \]\]> |
| 71 | + escape_captures: |
| 72 | + 0: meta.tag.sgml.cdata.html punctuation.definition.tag.end.html |
| 73 | + - match: '{{script_content_begin}}' |
| 74 | + captures: |
| 75 | + 1: comment.block.html punctuation.definition.comment.begin.html |
| 76 | + pop: 1 # make sure to match only once |
| 77 | + embed: scope:source.coffee |
| 78 | + embed_scope: source.coffee.embedded.html |
| 79 | + escape: '{{script_content_end}}' |
| 80 | + escape_captures: |
| 81 | + 1: source.coffee.embedded.html |
| 82 | + 2: comment.block.html punctuation.definition.comment.end.html |
| 83 | + 3: source.coffee.embedded.html |
| 84 | + 4: comment.block.html punctuation.definition.comment.end.html |
| 85 | + |
| 86 | +variables: |
| 87 | + |
| 88 | + coffee_mime_type: |- |
| 89 | + (?xi: (?: (?: application |text ) / coffee(?:script)? ) {{mime_type_parameters}}? ) |
0 commit comments