diff options
author | farwyler | 2022-12-27 14:57:09 +0000 |
---|---|---|
committer | GitHub | 2022-12-27 14:57:09 +0000 |
commit | 1f4d277013783c9c537444299ba4e558b9047fe2 (patch) | |
tree | d744bb0a5732c3ee0772ce69220e9a379a96b8c0 /runtime | |
parent | ebaf01924dd0e6251535d88ec0a2a00e88680d6b (diff) |
Allow custom preprocessors for 'vue' injections (#5268)
Diffstat (limited to 'runtime')
-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")) |