summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorfarwyler2022-12-27 14:57:09 +0000
committerGitHub2022-12-27 14:57:09 +0000
commit1f4d277013783c9c537444299ba4e558b9047fe2 (patch)
treed744bb0a5732c3ee0772ce69220e9a379a96b8c0 /runtime
parentebaf01924dd0e6251535d88ec0a2a00e88680d6b (diff)
Allow custom preprocessors for 'vue' injections (#5268)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/vue/injections.scm30
1 files changed, 27 insertions, 3 deletions
diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm
index 73df868b..1b053e74 100644
--- a/runtime/queries/vue/injections.scm
+++ b/runtime/queries/vue/injections.scm
@@ -8,13 +8,37 @@
(raw_text) @injection.content)
(#set! injection.language "javascript"))
+; <script>
((script_element
+ (start_tag) @_no_lang
+ (raw_text) @injection.content)
+ (#not-match? @_no_lang "lang=")
+ (#set! injection.language "javascript"))
+
+; <script lang="...">
+((script_element
+ (start_tag
+ (attribute
+ (attribute_name) @_attr_name
+ (quoted_attribute_value (attribute_value) @injection.language)))
(raw_text) @injection.content)
- (#set! injection.language "javascript"))
+ (#eq? @_attr_name "lang"))
+; <style>
((style_element
- (raw_text) @injection.content)
- (#set! injection.language "css"))
+ (start_tag) @_no_lang
+ (raw_text) @injection.content)
+ (#not-match? @_no_lang "lang=")
+ (#set! injection.language "css"))
+
+; <style lang="...">
+((style_element
+ (start_tag
+ (attribute
+ (attribute_name) @_attr_name
+ (quoted_attribute_value (attribute_value) @injection.language)))
+ (raw_text) @injection.content)
+ (#eq? @_attr_name "lang"))
((comment) @injection.content
(#set! injection.language "comment"))