From da3db24380a03bcf31c7cd57d88c61eb978e16ce Mon Sep 17 00:00:00 2001 From: Michael <20937441+KMikeeU@users.noreply.github.com> Date: Fri, 7 Apr 2023 16:29:10 +0200 Subject: [PATCH 1/3] Added DTD Language Support - Added syntax highlighting for the DTD subset of the XML spec. - Included .dtd and .ent as common file extensions --- languages.toml | 18 ++++++++++++++ runtime/queries/dtd/highlights.scm | 39 ++++++++++++++++++++++++++++++ runtime/queries/dtd/injections.scm | 2 ++ 3 files changed, 59 insertions(+) create mode 100644 runtime/queries/dtd/highlights.scm create mode 100644 runtime/queries/dtd/injections.scm diff --git a/languages.toml b/languages.toml index c643beab19c9..df575f960917 100644 --- a/languages.toml +++ b/languages.toml @@ -2099,6 +2099,24 @@ roots = [] name = "xml" source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "48a7c2b6fb9d515577e115e6788937e837815651" } + +[[language]] +name = "dtd" +scope = "source.dtd" +injection-regex = "dtd" +file-types = ["dtd", "ent"] +indent = {tab-width = 2, unit = " "} +roots = [] + +[language.auto-pairs] +'(' = ')' +'[' = ']' +'<' = '>' + +[[grammar]] +name = "dtd" +source = { git = "https://github.com/KMikeeU/tree-sitter-dtd", rev = "6116becb02a6b8e9588ef73d300a9ba4622e156f"} + [[language]] name = "wit" scope = "source.wit" diff --git a/runtime/queries/dtd/highlights.scm b/runtime/queries/dtd/highlights.scm new file mode 100644 index 000000000000..cb3d482b5aec --- /dev/null +++ b/runtime/queries/dtd/highlights.scm @@ -0,0 +1,39 @@ +; highlights.scm + +(comment) @comment + +[ + "ELEMENT" + "ATTLIST" +] @keyword + +[ + "#REQUIRED" + "#IMPLIED" + "#FIXED" + "#PCDATA" +] @keyword.directive + +[ + "EMPTY" + "ANY" + "SYSTEM" + "PUBLIC" +] @constant + +(element_name) @module + + +(attribute_name) @attribute + +(system_literal) @string +(pubid_literal) @string +(attribute_value) @string + +[ + ">" + "" + " Date: Fri, 7 Apr 2023 16:42:49 +0200 Subject: [PATCH 2/3] Generated docs for dtd language support --- book/src/generated/lang-support.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 3f56dd606b32..ebcdbd366df3 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -27,6 +27,7 @@ | diff | ✓ | | | | | dockerfile | ✓ | | | `docker-langserver` | | dot | ✓ | | | `dot-language-server` | +| dtd | ✓ | | | | | edoc | ✓ | | | | | eex | ✓ | | | | | ejs | ✓ | | | | From c6f11ee19fd31d0aef9cc28f60fd9f498941450a Mon Sep 17 00:00:00 2001 From: Michael <20937441+KMikeeU@users.noreply.github.com> Date: Fri, 7 Apr 2023 17:00:23 +0200 Subject: [PATCH 3/3] dtd: Added auto-pairs for ' and " --- languages.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/languages.toml b/languages.toml index df575f960917..3fb96365075d 100644 --- a/languages.toml +++ b/languages.toml @@ -2111,6 +2111,8 @@ roots = [] [language.auto-pairs] '(' = ')' '[' = ']' +'"' = '"' +"'" = "'" '<' = '>' [[grammar]]