diff options
-rw-r--r-- | runtime/queries/vue/injections.scm | 30 |
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")) |