From d449431e95f1a553926ad54fdef14d41256829b1 Mon Sep 17 00:00:00 2001 From: danymat Date: Sat, 5 Mar 2022 14:16:19 +0100 Subject: [PATCH] feat(rb) Add support for tomdoc --- lua/neogen/configurations/ruby.lua | 6 +++--- lua/neogen/init.lua | 4 +++- lua/neogen/templates/tomdoc.lua | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 lua/neogen/templates/tomdoc.lua diff --git a/lua/neogen/configurations/ruby.lua b/lua/neogen/configurations/ruby.lua index 66fc3e5..a13b423 100644 --- a/lua/neogen/configurations/ruby.lua +++ b/lua/neogen/configurations/ruby.lua @@ -7,7 +7,7 @@ local template = {} template.parent = { func = { "method" }, - class = { "class" }, + class = { "class", "module" }, type = { "call" }, } @@ -53,7 +53,7 @@ template.data = { }, }, class = { - ["class"] = { + ["class|module"] = { ["0"] = { extract = function() return {} @@ -72,6 +72,6 @@ template.data = { }, } -template.template = _template:add_default_annotation("yard"):add_annotation("rdoc") +template.template = _template:add_default_annotation("yard"):add_annotation("rdoc"):add_annotation("tomdoc") return template diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 4af42c8..eff77d4 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -216,6 +216,8 @@ end --- --- Note: We will only document `major` and `minor` versions, not `patch` ones. --- +--- ## 2.5.0~ +--- - Ruby: Add support for `tomdoc` (http://tomdoc.org) --- ## 2.4.0~ --- - Improve godoc template (#75) --- ## 2.3.0~ @@ -236,7 +238,7 @@ end --- with multiple annotation conventions. ---@tag neogen-changelog ---@toc_entry Changes in neogen plugin -neogen.version = "2.4.0" +neogen.version = "2.5.0" --minidoc_afterlines_end return neogen diff --git a/lua/neogen/templates/tomdoc.lua b/lua/neogen/templates/tomdoc.lua new file mode 100644 index 0000000..35f5ca4 --- /dev/null +++ b/lua/neogen/templates/tomdoc.lua @@ -0,0 +1,8 @@ +local i = require("neogen.types.template").item + +return { + { nil, "# Public: $1", { type = { "func", "class" } } }, + { nil, "# Public: $1", { type = { "class", "func" }, no_results = true } }, + { i.Parameter, "# %s - $1", { before_first_item = { "#" } } }, + { i.Return, "# Returns $1", { before_first_item = { "#" } } }, +}