mirror of https://github.com/folke/lazy.nvim.git
ci: better docgen
This commit is contained in:
parent
e888d5b64c
commit
e753eb6025
|
@ -109,9 +109,15 @@ function M.table(lines)
|
||||||
return table.concat(ret, "\n")
|
return table.concat(ret, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param opts? {name?:string, path?:string, modname?:string}
|
||||||
---@return ReadmeBlock
|
---@return ReadmeBlock
|
||||||
function M.colors()
|
function M.colors(opts)
|
||||||
local str = M.extract("lua/lazy/view/colors.lua", "\nM%.colors = ({.-\n})")
|
opts = vim.tbl_extend("force", {
|
||||||
|
name = "Lazy",
|
||||||
|
path = "lua/lazy/view/colors.lua",
|
||||||
|
modname = "lazy.view.colors",
|
||||||
|
}, opts or {})
|
||||||
|
local str = M.extract(opts.path, "\nM%.colors = ({.-\n})")
|
||||||
---@type table<string,string>
|
---@type table<string,string>
|
||||||
local comments = {}
|
local comments = {}
|
||||||
for _, line in ipairs(vim.split(str, "\n")) do
|
for _, line in ipairs(vim.split(str, "\n")) do
|
||||||
|
@ -124,8 +130,8 @@ function M.colors()
|
||||||
{ "Highlight Group", "Default Group", "Description" },
|
{ "Highlight Group", "Default Group", "Description" },
|
||||||
{ "---", "---", "---" },
|
{ "---", "---", "---" },
|
||||||
}
|
}
|
||||||
Util.foreach(require("lazy.view.colors").colors, function(group, link)
|
Util.foreach(require(opts.modname).colors, function(group, link)
|
||||||
lines[#lines + 1] = { "**Lazy" .. group .. "**", "***" .. link .. "***", comments[group] or "" }
|
lines[#lines + 1] = { "**" .. opts.name .. group .. "**", "***" .. link .. "***", comments[group] or "" }
|
||||||
end)
|
end)
|
||||||
return { content = M.table(lines) }
|
return { content = M.table(lines) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue