mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
schema: Include table descriptions in generated MD
This commit is contained in:
parent
69067579e5
commit
3ff8a8da55
20
schema.lua
20
schema.lua
@ -72,11 +72,23 @@ end
|
||||
|
||||
function generate_markdown(self)
|
||||
-- TODO address redundancies
|
||||
local function description(lines)
|
||||
local description = self.description
|
||||
if description then
|
||||
if type(description) ~= "table" then
|
||||
table.insert(lines, description)
|
||||
else
|
||||
modlib.table.append(lines, description)
|
||||
end
|
||||
end
|
||||
end
|
||||
local typ = self.type
|
||||
self.title = self.title or field_name_to_title(self._md_name)
|
||||
self._md_level = self._md_level or 1
|
||||
if typ == "table" then
|
||||
local settings = {}
|
||||
description(settings)
|
||||
-- TODO generate Markdown for key/value-checks
|
||||
local function setting(key, value_scheme)
|
||||
value_scheme._md_name = key
|
||||
value_scheme.title = value_scheme.title or self.title .. " " .. field_name_to_title(key)
|
||||
@ -103,14 +115,6 @@ function generate_markdown(self)
|
||||
local function line(text)
|
||||
table.insert(lines, "* " .. text)
|
||||
end
|
||||
local description = self.description
|
||||
if description then
|
||||
if type(description) ~= "table" then
|
||||
table.insert(lines, description)
|
||||
else
|
||||
modlib.table.append(lines, description)
|
||||
end
|
||||
end
|
||||
table.insert(lines, "")
|
||||
line("Type: " .. self.type)
|
||||
if self.default ~= nil then
|
||||
|
Loading…
Reference in New Issue
Block a user