diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/rst/injections.scm | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/rst/injections.scm')
| -rw-r--r-- | runtime/queries/rst/injections.scm | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/runtime/queries/rst/injections.scm b/runtime/queries/rst/injections.scm new file mode 100644 index 000000000..7178de9da --- /dev/null +++ b/runtime/queries/rst/injections.scm @@ -0,0 +1,72 @@ +((doctest_block) @injection.content + (#set! injection.language "python")) + +; Directives with nested content without arguments nor options +((directive + name: (type) @_type + body: (body) @injection.content) + (#set! injection.language "rst") + (#any-of? @_type + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound" "header" "footer" + "meta" "replace")) + +; Directives with nested content without arguments, but with options +((directive + name: (type) @_type + body: (body + (options) + (content) @injection.content)) + (#set! injection.language "rst") + (#any-of? @_type + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "line-block" "parsed-literal" "compound")) + +; Directives with nested content with arguments and options +((directive + name: (type) @_type + body: (body + (content) @injection.content)) + (#set! injection.language "rst") + (#any-of? @_type + "figure" "topic" "sidebar" "container" "table" "list-table" "class" "role" + "restructuredtext-test-directive")) + +; Special directives +((directive + name: (type) @_type + body: (body + (arguments) @injection.language + (content) @injection.content)) + (#any-of? @_type "raw" "code" "code-block" "sourcecode")) + +((directive + name: (type) @_type + body: (body + (content) @injection.content)) + (#set! injection.language "latex") + (#eq? @_type "math")) + +((directive + name: (type) @_type + body: (body + (content) @injection.content)) + (#set! injection.language "csv") + (#eq? @_type "csv-table")) + +; Special roles - prefix +((interpreted_text + (role) @_role + "interpreted_text" @injection.content) + (#eq? @_role ":math:") + (#set! injection.language "latex")) + +; Special roles - suffix +((interpreted_text + "interpreted_text" @injection.content + (role) @_role) + (#eq? @_role ":math:") + (#set! injection.language "latex")) + +((comment) @injection.content + (#set! injection.language "comment")) |
