[html] update html grammar

This commit is contained in:
Martin Aeschlimann
2017-04-25 23:40:07 +02:00
parent 7c13b3cda6
commit 2c70320d48
5 changed files with 545 additions and 305 deletions

View File

@@ -10,7 +10,7 @@
],
"firstLineMatch": "<(?i:(!DOCTYPE\\s*)?html)",
"injections": {
"R:text.html - comment.block": {
"R:text.html - (comment.block, text.html source)": {
"comment": "Use R: to ensure this matches after any other injections.",
"patterns": [
{
@@ -24,7 +24,7 @@
"name": "HTML",
"patterns": [
{
"begin": "(<)([a-zA-Z0-9:\\-]++)(?=[^>]*></\\2>)",
"begin": "(<)([a-zA-Z][a-zA-Z0-9:-]*)(?=[^>]*></\\2>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.html"
@@ -139,104 +139,256 @@
"include": "#embedded-code"
},
{
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?![^>]*/>)",
"captures": {
"1": {
"name": "punctuation.definition.tag.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(</)((?i:style))(>)(?:\\s*\\n)?",
"patterns": [
{
"include": "#tag-stuff"
},
{
"contentName": "source.css.embedded.html",
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.html"
}
},
"end": "(?=</(?i:style))",
"patterns": [
{
"include": "#embedded-code"
},
{
"include": "source.css"
}
]
}
]
},
{
"begin": "(?:^\\s+)?(<)((?i:script))\\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript).*)))",
"begin": "(^[ \\t]+)?(?=<(?i:style))",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.html"
},
"2": {
"name": "entity.name.tag.script.html"
"name": "punctuation.whitespace.embedded.leading.html"
}
},
"end": "(?<=</(script|SCRIPT))(>)(?:\\s*\\n)?",
"end": "(?!\\G)([ \\t]*$\\n?)?",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.html"
"1": {
"name": "punctuation.whitespace.embedded.trailing.html"
}
},
"patterns": [
{
"include": "#tag-stuff"
},
{
"contentName": "source.js.embedded.html",
"begin": "(?<!</(?:script|SCRIPT))(>)",
"captures": {
"begin": "(<)((?i:style))\\b",
"beginCaptures": {
"0": {
"name": "meta.tag.metadata.style.html"
},
"1": {
"name": "punctuation.definition.tag.html"
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.script.html"
"name": "entity.name.tag.html"
}
},
"end": "(</)((?i:script))",
"end": "(/>)|((<)/)((?i:style))(>)",
"endCaptures": {
"0": {
"name": "meta.tag.metadata.style.html"
},
"1": {
"name": "punctuation.definition.tag.end.html"
},
"2": {
"name": "punctuation.definition.tag.begin.html"
},
"3": {
"name": "source.css"
},
"4": {
"name": "entity.name.tag.html"
},
"5": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.embedded.block.html",
"patterns": [
{
"begin": "\\G",
"captures": {
"1": {
"name": "punctuation.definition.comment.js"
"name": "punctuation.definition.tag.end.html"
}
},
"match": "(//).*?((?=</script)|$\\n?)",
"name": "comment.line.double-slash.js"
},
{
"begin": "/\\*",
"captures": {
"0": {
"name": "punctuation.definition.comment.js"
"end": "(?=/>)|(>)",
"name": "meta.tag.metadata.style.html",
"patterns": [
{
"include": "#tag-stuff"
}
},
"end": "\\*/|(?=</script)",
"name": "comment.block.js"
]
},
{
"include": "source.js"
"begin": "(?!\\G)",
"end": "(?=</(?i:style))",
"name": "source.css",
"patterns": [
{
"include": "#embedded-code"
},
{
"include": "source.css"
}
]
}
]
}
]
},
{
"begin": "(</?)((?i:body|head|html)(?=\\s|\\\\|>))",
"begin": "(^[ \\t]+)?(?=<(?i:script))",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.embedded.leading.html"
}
},
"end": "(?!\\G)([ \\t]*$\\n?)?",
"endCaptures": {
"1": {
"name": "punctuation.whitespace.embedded.trailing.html"
}
},
"patterns": [
{
"begin": "(<)((?i:script))\\b",
"beginCaptures": {
"0": {
"name": "meta.tag.metadata.script.html"
},
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.html"
}
},
"end": "(/>)|(/)((?i:script))(>)",
"endCaptures": {
"0": {
"name": "meta.tag.metadata.script.html"
},
"1": {
"name": "punctuation.definition.tag.end.html"
},
"2": {
"name": "punctuation.definition.tag.begin.html"
},
"3": {
"name": "entity.name.tag.html"
},
"4": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.embedded.block.html",
"patterns": [
{
"begin": "\\G",
"end": "(?=/>|/)",
"patterns": [
{
"begin": "(>)",
"beginCaptures": {
"0": {
"name": "meta.tag.metadata.script.html"
},
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "((<))(?=/(?i:script))",
"endCaptures": {
"0": {
"name": "meta.tag.metadata.script.html"
},
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "source.js"
}
},
"patterns": [
{
"begin": "\\G",
"end": "(?=</(?i:script))",
"name": "source.js",
"patterns": [
{
"begin": "(^[ \\t]+)?(?=//)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.js"
}
},
"end": "(?!\\G)",
"patterns": [
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.js"
}
},
"end": "(?=</script)|\\n",
"name": "comment.line.double-slash.js"
}
]
},
{
"begin": "/\\*",
"captures": {
"0": {
"name": "punctuation.definition.comment.js"
}
},
"end": "\\*/|(?=</script)",
"name": "comment.block.js"
},
{
"include": "source.js"
}
]
}
]
},
{
"begin": "\\G",
"end": "(?i:(?=/?>|type\\s*=\\s*('|\"|)(?!text/(javascript|ecmascript)|application/((x-)?javascript|ecmascript))\\b))",
"name": "meta.tag.metadata.script.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(?=(?i:type))",
"end": "(<)(?=/(?i:script))",
"endCaptures": {
"0": {
"name": "meta.tag.metadata.script.html"
},
"1": {
"name": "punctuation.definition.tag.begin.html"
}
},
"patterns": [
{
"begin": "\\G",
"end": "(>)|(?=/>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.metadata.script.html",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(?!\\G)",
"end": "(?=</(?i:script))",
"name": "source.unknown"
}
]
}
]
}
]
}
]
},
{
"begin": "(</?)((?i:body|head|html)\\b)",
"captures": {
"1": {
"name": "punctuation.definition.tag.html"
@@ -254,7 +406,7 @@
]
},
{
"begin": "(</?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)(?=\\s|\\\\|>))",
"begin": "(</?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)\\b)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
@@ -277,7 +429,7 @@
]
},
{
"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)(?=\\s|\\\\|>))",
"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(?!-))",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
@@ -300,7 +452,7 @@
]
},
{
"begin": "(</?)([a-zA-Z0-9:\\-]+)",
"begin": "(</?)([a-zA-Z][a-zA-Z0-9:-]*)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
@@ -309,7 +461,7 @@
"name": "entity.name.tag.other.html"
}
},
"end": "(>)",
"end": "(/?>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
@@ -364,7 +516,7 @@
"python": {
"begin": "(?:^\\s*)<\\?python(?!.*\\?>)",
"end": "\\?>(?:\\s*$\\n)?",
"contentName": "source.python.embedded.html",
"name": "source.python.embedded.html",
"patterns": [
{
"include": "source.python"
@@ -389,7 +541,7 @@
"begin": "{{|{",
"disabled": 1,
"end": "}}|}",
"contentName": "source.smarty.embedded.html",
"name": "source.smarty.embedded.html",
"patterns": [
{
"include": "source.smarty"
@@ -549,5 +701,5 @@
},
"scopeName": "text.html.basic",
"uuid": "17994EC8-6B1D-11D9-AC3A-000D93589AF6",
"version": "https://github.com/textmate/html.tmbundle/commit/9f812c89f4990a98391701caa77824c94860538f"
"version": "https://github.com/textmate/html.tmbundle/commit/d66526c5f6b6080358d7bf648654165a4fabf713"
}