Skip to content

Commit

Permalink
Update injections format (#19)
Browse files Browse the repository at this point in the history
The old format was deprecated by neovim.

If you are using an old version of neovim, please pin to the previous commit (ec53a6e).
  • Loading branch information
stsewd authored Aug 25, 2023
1 parent ec53a6e commit d4eceb3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
43 changes: 25 additions & 18 deletions after/queries/rst/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,79 @@

((directive
name: (type) @_type
body: (body (content) @rst))
body: (body (content) @injection.content))
(#any-of?
@_type
"toctree"
"versionadded" "versionchanged" "deprecated" "seealso" "centered" "hlist"
"glossary"
"index"
"productionlist"))
"productionlist")
(#set! injection.language "rst"))

((directive
name: (type) @_type
body: (body (arguments) @rst))
(#any-of? @_type "sectionauthor" "codeauthor"))
body: (body (arguments) @injection.content))
(#any-of? @_type "sectionauthor" "codeauthor")
(#set! injection.language "rst"))

;; Code highlight directives
((directive
name: (type) @_type
body: (body (arguments) @language (content) @content))
body: (body (arguments) @injection.language (content) @injection.content))
(#eq? @_type "highlight"))

;; Most directives from domains accept nested content
((directive
name: (type) @_type
body: (body (content) @rst))
(#match? @_type "^(py|c|cpp|js|rst):"))
body: (body (content) @injection.content))
(#match? @_type "^(py|c|cpp|js|rst):")
(#set! injection.language "rst"))

((directive
name: (type) @_type
body: (body (content) @rst))
(#any-of? @_type "default-domain" "option" "envar" "program" "describe" "object"))
body: (body (content) @injection.content))
(#any-of? @_type "default-domain" "option" "envar" "program" "describe" "object")
(#set! injection.language "rst"))

;; Directives from common extensions

;;; Sphinx docs
((directive
name: (type) @_type
body: (body (content) @rst))
(#eq? @_type "confval"))
body: (body (content) @injection.content))
(#eq? @_type "confval")
(#set! injection.language "rst"))

;;; sphinx-tabs
;;; https://github.com/executablebooks/sphinx-tabs
((directive
name: (type) @_type
body: (body (content) @rst))
(#any-of? @_type "tabs" "tab" "group-tab"))
body: (body (content) @injection.content))
(#any-of? @_type "tabs" "tab" "group-tab")
(#set! injection.language "rst"))

((directive
name: (type) @_type
body: (body (arguments) @language (content) @content))
body: (body (arguments) @injection.language (content) @injection.content))
(#eq? @_type "code-tab"))

;;; http domain
;;; https://sphinxcontrib-httpdomain.readthedocs.io/
((directive
name: (type) @_type
body: (body (content) @rst))
(#match? @_type "^(http):"))
body: (body (content) @injection.content))
(#match? @_type "^(http):")
(#set! injection.language "rst"))

((directive
name: (type) @_type
body: (body (arguments) @language (content) @content))
body: (body (arguments) @injection.language (content) @injection.content))
(#eq? @_type "sourcecode"))

;;; sphinx-prompt
;;; https://github.com/sbrunner/sphinx-prompt
((directive
name: (type) @_type
body: (body (arguments) @language (content) @content))
body: (body (arguments) @injection.language (content) @injection.content))
(#eq? @_type "prompt"))

0 comments on commit d4eceb3

Please sign in to comment.