diff --git a/languages.toml b/languages.toml index 0eaafac3..271a5da0 100644 --- a/languages.toml +++ b/languages.toml @@ -5547,3 +5547,14 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "p" source = { git = "https://github.com/battesonb/tree-sitter-p", rev = "701dcc1c72f425f78bc128d2b8031686a60ae058" } + +[[language]] +name = "xwiki" +scope = "source.xwiki" +injection-regex = "xwiki" +file-types = ["xwiki"] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "xwiki" +source = { git = "https://github.com/battesonb/tree-sitter-xwiki", rev = "58010c62c63fabbf5a94762bfa8849d4733d1f6c" } diff --git a/runtime/queries/xwiki/highlights.scm b/runtime/queries/xwiki/highlights.scm new file mode 100644 index 00000000..ef20dbbd --- /dev/null +++ b/runtime/queries/xwiki/highlights.scm @@ -0,0 +1,28 @@ +(h1) @markup.heading.1 +(h2) @markup.heading.2 +(h3) @markup.heading.3 +(h4) @markup.heading.4 +(h5) @markup.heading.5 +(h6) @markup.heading.6 + +(strong) @markup.bold +(em) @markup.italic +(strikethrough) @markup.strikethrough +(underline) @markup.underline + +(block_quote) @markup.quote +(verbatim_content) @markup.raw + +(string) @string + +(horizontal_line) @comment + +(link) @markup.link + +(macro_name) @keyword.directive +"macro_end" @keyword.directive + +(param_name) @variable.other.member + +(parameters_open) @punctuation.bracket +(parameters_close) @punctuation.bracket diff --git a/runtime/queries/xwiki/injections.scm b/runtime/queries/xwiki/injections.scm new file mode 100644 index 00000000..e3eda2df --- /dev/null +++ b/runtime/queries/xwiki/injections.scm @@ -0,0 +1,56 @@ +; extends + +; Support injections for the code macro +(macro + name: (macro_name) @_macro_name + params: (macro_params + (macro_param + name: (param_name) @_param_name + value: (param_value + (string + (string_content) @injection.language)))) + (macro_content) @injection.content + (#match? @_macro_name "^code$") + (#match? @_param_name "^language$")) + +; Support the HTML macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^html$") + (#set! injection.language "html")) + +; Support the Python macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^python$") + (#set! injection.language "python")) + +; Support the Ruby macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^ruby$") + (#set! injection.language "ruby")) + +; Support the Groovy macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^groovy$") + (#set! injection.language "^groovy")) + +; Support the Velocity macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^velocity$") + (#set! injection.language "^velocity")) + +; Support the PHP macro +(macro + name: (macro_name) @_macro_name + (macro_content) @injection.content + (#match? @_macro_name "^php$") + (#set! injection.language "php"))