aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/html_tags/injections.scm30
1 files changed, 27 insertions, 3 deletions
diff --git a/runtime/queries/html_tags/injections.scm b/runtime/queries/html_tags/injections.scm
index 5b78e37b4..1c8ce012b 100644
--- a/runtime/queries/html_tags/injections.scm
+++ b/runtime/queries/html_tags/injections.scm
@@ -32,16 +32,40 @@
(#not-lua-match? @_no_type_lang "%stype%s*=")
(#set! injection.language "javascript"))
-; <script type="mimetype-or-well-known-script-type">
+; <script type="foo/bar">
(script_element
(start_tag
(attribute
(attribute_name) @_attr
(#eq? @_attr "type")
(quoted_attribute_value
- (attribute_value) @_type)))
+ (attribute_value) @injection.language)))
(raw_text) @injection.content
- (#set-lang-from-mimetype! @_type))
+ (#gsub! @injection.language "(.+)/(.+)" "%2"))
+
+; <script type="importmap">
+((script_element
+ (start_tag
+ (attribute
+ (attribute_name) @_attr
+ (#eq? @_attr "type")
+ (quoted_attribute_value
+ (attribute_value) @_type)))
+ (raw_text) @injection.content)
+ (#eq? @_type "importmap")
+ (#set! injection.language "json"))
+
+; <script type="module">
+((script_element
+ (start_tag
+ (attribute
+ (attribute_name) @_attr
+ (#eq? @_attr "type")
+ (quoted_attribute_value
+ (attribute_value) @_type)))
+ (raw_text) @injection.content)
+ (#eq? @_type "module")
+ (#set! injection.language "javascript"))
; <a style="/* css */">
((attribute