%YAML 1.2 --- name: HTML file_extensions: - html - htm - shtml - xhtml - inc - tmpl - tpl first_line_match: (?i)<(!DOCTYPE\s*)?html scope: text.html.basic contexts: main: - match: (<\?)(xml) captures: 1: punctuation.definition.tag.begin.html 2: entity.name.tag.xml.html push: - meta_scope: meta.tag.preprocessor.xml.html - match: '\?>' scope: punctuation.definition.tag.end.html pop: true - include: tag-generic-attribute - include: string-double-quoted - include: string-single-quoted - match: )?\s*() captures: 0: meta.tag.script.end.html 1: comment.block.html punctuation.definition.comment.html 2: punctuation.definition.tag.begin.html 3: entity.name.tag.script.html 4: punctuation.definition.tag.end.html pop: true - match: '(>)\s*()?\s*)' pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: (' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - match: "(' scope: punctuation.definition.tag.end.html pop: true - include: tag-stuff - include: entities - match: <> scope: invalid.illegal.incomplete.html entities-common: - match: "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)" scope: constant.character.entity.html captures: 1: punctuation.definition.entity.html 3: punctuation.definition.entity.html attribute-entities: - include: entities-common entities: - include: entities-common - match: "&" scope: invalid.illegal.bad-ampersand.html string-double-quoted: - match: '"' scope: punctuation.definition.string.begin.html push: - meta_scope: string.quoted.double.html - match: '"' scope: punctuation.definition.string.end.html pop: true - include: entities string-single-quoted: - match: "'" scope: punctuation.definition.string.begin.html push: - meta_scope: string.quoted.single.html - match: "'" scope: punctuation.definition.string.end.html pop: true - include: entities tag-generic-attribute: - match: '(?:^|\s+)(([a-zA-Z0-9:\-_.]+)\s*(=)\s*)' captures: 1: meta.attribute-with-value.html 2: entity.other.attribute-name.html 3: punctuation.separator.key-value.html push: - match: '"' scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.html string.quoted.double.html - match: '"' scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: "'" scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.html string.quoted.single.html - match: "'" scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: '(?:[^\s<>/''"]|/(?!>))+' scope: meta.attribute-with-value.html string.unquoted.html - match: '' pop: true - match: '\s+([a-zA-Z0-9:\-_.]+)' captures: 1: entity.other.attribute-name.html tag-class-attribute: - match: '(?:^|\s+)\b((class)\b\s*(=)\s*)' captures: 1: meta.attribute-with-value.class.html 2: entity.other.attribute-name.class.html 3: punctuation.separator.key-value.html push: - match: '"' scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.class.html string.quoted.double.html - meta_content_scope: meta.class-name.html - match: '"' scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: "'" scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.class.html string.quoted.single.html - meta_content_scope: meta.class-name.html - match: "'" scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: '(?:[^\s<>/''"]|/(?!>))+' scope: meta.attribute-with-value.class.html string.unquoted.html meta.class-name.html - match: '' pop: true tag-id-attribute: - match: '(?:^|\s+)\b((id)\b\s*(=)\s*)' captures: 1: meta.attribute-with-value.id.html 2: entity.other.attribute-name.id.html 3: punctuation.separator.key-value.html push: - match: '"' scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.id.html string.quoted.double.html - meta_content_scope: meta.toc-list.id.html - match: '"' scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: "'" scope: punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.id.html string.quoted.single.html - meta_content_scope: meta.toc-list.id.html - match: "'" scope: punctuation.definition.string.end.html pop: true - include: attribute-entities - match: '(?:[^\s<>/''"]|/(?!>))+' scope: meta.attribute-with-value.id.html string.unquoted.html meta.toc-list.id.html - match: '' pop: true tag-style-attribute: - match: '(?:^|\s+)\b((style)\b\s*(=)\s*)' captures: 1: meta.attribute-with-value.style.html 2: entity.other.attribute-name.style.html 3: punctuation.separator.key-value.html push: - match: '"' scope: string.quoted.double punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.style.html - meta_content_scope: source.css - match: '"' scope: string.quoted.double punctuation.definition.string.end.html pop: true - match: '' # An anonymous context with an include is used here rather than # a direct push, so that if the target context isn't found it's # only a warning rather than an error. This will likely happen # if the user has replaced the default CSS syntax push: - include: 'CSS.sublime-syntax#rule-list-body' with_prototype: - match: '(?=")' pop: true - include: attribute-entities - match: "'" scope: string.quoted.single punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.style.html - meta_content_scope: source.css - match: "'" scope: string.quoted.single punctuation.definition.string.end.html pop: true - match: '' # An anonymous context with an include is used here rather than # a direct push, so that if the target context isn't found it's # only a warning rather than an error. This will likely happen # if the user has replaced the default CSS syntax push: - include: 'CSS.sublime-syntax#rule-list-body' with_prototype: - match: "(?=')" pop: true - include: attribute-entities - match: '' pop: true tag-event-attribute: - match: |- (?x)\s*\b(( onabort|onautocomplete|onautocompleteerror|onblur|oncancel|oncanplay| oncanplaythrough|onchange|onclick|onclose|oncontextmenu|oncuechange| ondblclick|ondrag|ondragend|ondragenter|ondragexit|ondragleave|ondragover| ondragstart|ondrop|ondurationchange|onemptied|onended|onerror|onfocus| oninput|oninvalid|onkeydown|onkeypress|onkeyup|onload|onloadeddata| onloadedmetadata|onloadstart|onmousedown|onmouseenter|onmouseleave| onmousemove|onmouseout|onmouseover|onmouseup|onmousewheel|onpause|onplay| onplaying|onprogress|onratechange|onreset|onresize|onscroll|onseeked| onseeking|onselect|onshow|onsort|onstalled|onsubmit|onsuspend| ontimeupdate|ontoggle|onvolumechange|onwaiting)\b\s*(=)\s*) captures: 1: meta.attribute-with-value.event.html 2: entity.other.attribute-name.event.html 3: punctuation.separator.key-value.html push: - match: '"' scope: string.quoted.double punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.event.html - match: '"' scope: string.quoted.double punctuation.definition.string.end.html pop: true - match: '' push: 'scope:source.js' with_prototype: - match: '(?=")' pop: true - include: attribute-entities - match: "'" scope: string.quoted.single punctuation.definition.string.begin.html set: - meta_scope: meta.attribute-with-value.event.html - match: "'" scope: string.quoted.single punctuation.definition.string.end.html pop: true - match: '' push: 'scope:source.js' with_prototype: - match: "(?=')" pop: true - include: attribute-entities - match: '' pop: true tag-stuff: - include: tag-id-attribute - include: tag-class-attribute - include: tag-style-attribute - include: tag-event-attribute - include: tag-generic-attribute