--- 
name: HTML
fileTypes: 
- html
- htm
- shtml
- xhtml
- phtml
- php
- inc
- tmpl
- tpl
firstLineMatch: <!DOCTYPE|<(?i:html)
scopeName: text.html.basic
repository: 
  tag-stuff: 
    patterns: 
    - include: "#tag-id-attribute"
    - include: "#tag-generic-attribute"
    - include: "#string-double-quoted"
    - include: "#string-single-quoted"
    - include: "#embedded-code"
  string-double-quoted: 
    name: string.quoted.double.html
    endCaptures: 
      "0": 
        name: punctuation.definition.string.end.html
    begin: "\""
    beginCaptures: 
      "0": 
        name: punctuation.definition.string.begin.html
    end: "\""
    patterns: 
    - include: "#embedded-code"
    - include: "#entities"
  php: 
    patterns: 
    - name: source.php.embedded.line.empty.html
      captures: 
        "1": 
          name: source.php.embedded.line.empty.whitespace.html
      match: <\?(?i:php|=)?(\s*\?)>
    - name: source.php.embedded.block.html
      begin: (?:^\s*)(?=<\?(?i:php|=)?(?!.*\?>))
      applyEndPatternLast: 1
      end: (?<=\?>)(?:\s*$\n)?
      patterns: 
      - include: source.php
      comment: match only multi-line PHP with leading whitespace
    - name: source.php.embedded.line.html
      begin: (?=<\?(?i:php|=)?)
      applyEndPatternLast: 1
      end: (?<=\?>)
      patterns: 
      - include: source.php
  entities: 
    patterns: 
    - name: constant.character.entity.html
      captures: 
        "1": 
          name: punctuation.definition.entity.html
        "3": 
          name: punctuation.definition.entity.html
      match: (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)
    - name: invalid.illegal.bad-ampersand.html
      match: "&"
  string-single-quoted: 
    name: string.quoted.single.html
    endCaptures: 
      "0": 
        name: punctuation.definition.string.end.html
    begin: "'"
    beginCaptures: 
      "0": 
        name: punctuation.definition.string.begin.html
    end: "'"
    patterns: 
    - include: "#embedded-code"
    - include: "#entities"
  python: 
    name: source.python.embedded.html
    begin: (?:^\s*)<\?python(?!.*\?>)
    end: \?>(?:\s*$\n)?
    patterns: 
    - include: source.python
  tag-id-attribute: 
    name: meta.attribute-with-value.id.html
    captures: 
      "1": 
        name: entity.other.attribute-name.id.html
      "2": 
        name: punctuation.separator.key-value.html
    begin: \b(id)\b\s*(=)
    end: (?<='|")
    patterns: 
    - name: string.quoted.double.html
      endCaptures: 
        "0": 
          name: punctuation.definition.string.end.html
      begin: "\""
      contentName: meta.toc-list.id.html
      beginCaptures: 
        "0": 
          name: punctuation.definition.string.begin.html
      end: "\""
      patterns: 
      - include: "#embedded-code"
      - include: "#entities"
    - name: string.quoted.single.html
      endCaptures: 
        "0": 
          name: punctuation.definition.string.end.html
      begin: "'"
      contentName: meta.toc-list.id.html
      beginCaptures: 
        "0": 
          name: punctuation.definition.string.begin.html
      end: "'"
      patterns: 
      - include: "#embedded-code"
      - include: "#entities"
  tag-generic-attribute: 
    name: entity.other.attribute-name.html
    match: \b([a-zA-Z\-:]+)
  ruby: 
    patterns: 
    - name: comment.block.erb
      captures: 
        "0": 
          name: punctuation.definition.comment.erb
      begin: <%+#
      end: "%>"
    - name: source.ruby.embedded.html
      captures: 
        "0": 
          name: punctuation.section.embedded.ruby
      begin: <%+(?!>)=?
      end: -?%>
      patterns: 
      - name: comment.line.number-sign.ruby
        captures: 
          "1": 
            name: punctuation.definition.comment.ruby
        match: (#).*?(?=-?%>)
      - include: source.ruby
    - name: source.ruby.nitro.embedded.html
      captures: 
        "0": 
          name: punctuation.section.embedded.ruby.nitro
      begin: <\?r(?!>)=?
      end: -?\?>
      patterns: 
      - name: comment.line.number-sign.ruby.nitro
        captures: 
          "1": 
            name: punctuation.definition.comment.ruby.nitro
        match: (#).*?(?=-?\?>)
      - include: source.ruby
  smarty: 
    patterns: 
    - captures: 
        "1": 
          name: source.smarty.embedded.html
        "2": 
          name: support.function.built-in.smarty
      begin: (\{(literal)\})
      end: (\{/(literal)\})
    - name: source.smarty.embedded.html
      begin: "{{|{"
      end: "}}|}"
      disabled: 1
      patterns: 
      - include: source.smarty
  embedded-code: 
    patterns: 
    - include: "#ruby"
    - include: "#php"
    - include: "#smarty"
    - include: "#python"
uuid: 17994EC8-6B1D-11D9-AC3A-000D93589AF6
foldingStartMarker: |-
  (?x)
  		(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\b.*?>
  		|<!--(?!.*--\s*>)
  		|^<!--\ \#tminclude\ (?>.*?-->)$
  		|<\?(?:php)?.*\b(if|for(each)?|while)\b.+:
  		|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)
  		|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
  		)
patterns: 
- name: meta.tag.any.html
  endCaptures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: meta.scope.between-tag-pair.html
    "3": 
      name: entity.name.tag.html
    "4": 
      name: punctuation.definition.tag.html
  begin: (<)([a-zA-Z0-9:]+)(?=[^>]*></\2>)
  beginCaptures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.html
  end: (>(<)/)(\2)(>)
  patterns: 
  - include: "#tag-stuff"
- name: meta.tag.preprocessor.xml.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.xml.html
  begin: (<\?)(xml)
  end: (\?>)
  patterns: 
  - include: "#tag-generic-attribute"
  - include: "#string-double-quoted"
  - include: "#string-single-quoted"
- name: comment.block.html
  captures: 
    "0": 
      name: punctuation.definition.comment.html
  begin: <!--
  end: --\s*>
  patterns: 
  - name: invalid.illegal.bad-comments-or-CDATA.html
    match: --
  - include: "#embedded-code"
- name: meta.tag.sgml.html
  captures: 
    "0": 
      name: punctuation.definition.tag.html
  begin: <!
  end: ">"
  patterns: 
  - name: meta.tag.sgml.doctype.html
    captures: 
      "1": 
        name: entity.name.tag.doctype.html
    begin: (DOCTYPE)
    end: (?=>)
    patterns: 
    - name: string.quoted.double.doctype.identifiers-and-DTDs.html
      match: "\"[^\">]*\""
  - name: constant.other.inline-data.html
    begin: \[CDATA\[
    end: "]](?=>)"
  - name: invalid.illegal.bad-comments-or-CDATA.html
    match: (\s*)(?!--|>)\S(\s*)
- include: "#embedded-code"
- name: source.css.embedded.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.style.html
    "3": 
      name: punctuation.definition.tag.html
  begin: (?:^\s+)?(<)((?i:style))\b(?![^>]*/>)
  end: (</)((?i:style))(>)(?:\s*\n)?
  patterns: 
  - include: "#tag-stuff"
  - begin: (>)
    beginCaptures: 
      "1": 
        name: punctuation.definition.tag.html
    end: (?=</(?i:style))
    patterns: 
    - include: "#embedded-code"
    - include: source.css
- name: source.js.embedded.html
  endCaptures: 
    "2": 
      name: punctuation.definition.tag.html
  begin: (?:^\s+)?(<)((?i:script))\b(?![^>]*/>)
  beginCaptures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.script.html
  end: (?<=</(script|SCRIPT))(>)(?:\s*\n)?
  patterns: 
  - include: "#tag-stuff"
  - captures: 
      "1": 
        name: punctuation.definition.tag.html
      "2": 
        name: entity.name.tag.script.html
    begin: (?<!</(?:script|SCRIPT))(>)
    end: (</)((?i:script))
    patterns: 
    - name: comment.line.double-slash.js
      captures: 
        "1": 
          name: punctuation.definition.comment.js
      match: (//).*?((?=</script)|$\n?)
    - name: comment.block.js
      captures: 
        "0": 
          name: punctuation.definition.comment.js
      begin: /\*
      end: \*/|(?=</script)
    - include: "#php"
    - include: source.js
- name: meta.tag.structure.any.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.structure.any.html
  begin: (</?)((?i:body|head|html)\b)
  end: (>)
  patterns: 
  - include: "#tag-stuff"
- name: meta.tag.block.any.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.block.any.html
  begin: (</?)((?i:address|blockquote|dd|div|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\b)
  end: (>)
  patterns: 
  - include: "#tag-stuff"
- name: meta.tag.inline.any.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.inline.any.html
  begin: (</?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\b)
  end: (>)
  patterns: 
  - include: "#tag-stuff"
- name: meta.tag.other.html
  captures: 
    "1": 
      name: punctuation.definition.tag.html
    "2": 
      name: entity.name.tag.other.html
  begin: (</?)([a-zA-Z0-9:]+)
  end: (>)
  patterns: 
  - include: "#tag-stuff"
- include: "#entities"
- name: invalid.illegal.incomplete.html
  match: <>
- name: invalid.illegal.bad-angle-bracket.html
  match: <
foldingStopMarker: |-
  (?x)
  		(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)>
  		|^(?!.*?<!--).*?--\s*>
  		|^<!--\ end\ tminclude\ -->$
  		|<\?(?:php)?.*\bend(if|for(each)?|while)\b
  		|\{\{?/(if|foreach|capture|literal|foreach|php|section|strip)
  		|^[^{]*\}
  		)
keyEquivalent: ^~H
