mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
feat(html): injections in <script type>
refactor(html): remove superfluous injection query fix(html): associate "module" type with "javascript"
This commit is contained in:
parent
972da989bc
commit
19d9af8fb0
2 changed files with 33 additions and 10 deletions
|
|
@ -27,23 +27,23 @@
|
|||
(#not-match? @_no_type_lang "\\s(lang|type)\\s*\\=")
|
||||
(raw_text) @javascript))
|
||||
|
||||
(
|
||||
(script_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_type
|
||||
(quoted_attribute_value (attribute_value) @_javascript)))
|
||||
(raw_text) @javascript)
|
||||
(#eq? @_type "type")
|
||||
(#any-of? @_javascript "text/javascript" "module")
|
||||
)
|
||||
; <script type="mimetype-or-well-known-script-type">
|
||||
(script_element
|
||||
(start_tag
|
||||
((attribute
|
||||
(attribute_name) @_attr (#eq? @_attr "type")
|
||||
(quoted_attribute_value (attribute_value) @_type))))
|
||||
(raw_text) @content (#set-lang-from-mimetype! @_type))
|
||||
|
||||
; <a style="/* css */">
|
||||
((attribute
|
||||
(attribute_name) @_attr
|
||||
(quoted_attribute_value (attribute_value) @css))
|
||||
(#eq? @_attr "style"))
|
||||
|
||||
; lit-html style template interpolation
|
||||
; <a @click=${e => console.log(e)}>
|
||||
; <a @click="${e => console.log(e)}">
|
||||
((attribute
|
||||
(quoted_attribute_value (attribute_value) @javascript))
|
||||
(#match? @javascript "\\$\\{")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue