language_html: Improve subsyntax highlighting (#1043)

* language_html: Improve subsyntax highlighting

- Adjusted `<script>`/`<style>` tag detection to not break when attributes like `defer` are added
This commit is contained in:
Katrina Grace 2022-06-22 20:56:41 -06:00 committed by GitHub
parent 880e6e4f0f
commit beefb16469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 13 deletions

View File

@ -3,29 +3,20 @@ local syntax = require "core.syntax"
syntax.add { syntax.add {
name = "HTML", name = "HTML",
files = { "%.html?$" }, files = { "%.html?$" },
block_comment = { "<!--", "-->" }, block_comment = { "<!--", "-->" },
patterns = { patterns = {
{ {
pattern = { pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%s+[tT][yY][pP][eE]%s*=%s*" .. "<%s*[sS][cC][rR][iI][pP][tT]%f[%s>].->",
"['\"]%a+/[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT]['\"]%s*>", "<%s*/%s*[sS][cC][rR][iI][pP][tT]%s*>"
"<%s*/[sS][cC][rR][iI][pP][tT]>"
}, },
syntax = ".js", syntax = ".js",
type = "function" type = "function"
}, },
{ {
pattern = { pattern = {
"<%s*[sS][cC][rR][iI][pP][tT]%s*>", "<%s*[sS][tT][yY][lL][eE]%f[%s>].->",
"<%s*/%s*[sS][cC][rR][iI][pP][tT]>"
},
syntax = ".js",
type = "function"
},
{
pattern = {
"<%s*[sS][tT][yY][lL][eE][^>]*>",
"<%s*/%s*[sS][tT][yY][lL][eE]%s*>" "<%s*/%s*[sS][tT][yY][lL][eE]%s*>"
}, },
syntax = ".css", syntax = ".css",