Generation fix

This commit is contained in:
Robert Jelic
2025-10-30 08:20:28 +01:00
parent 535b109dee
commit fa25007de6

View File

@@ -16,6 +16,13 @@ local function processDescription(description)
return table.concat(lines, "\n") return table.concat(lines, "\n")
end end
local function escapeInlineCode(text)
if not text then return text end
text = text:gsub("({%b[]})", "`%1`")
text = text:gsub("(%b[]%s*=%s*[^%s,}]+)", "`%1`")
return text
end
local function generateFunctionMarkdown(class, functions) local function generateFunctionMarkdown(class, functions)
local md = {} local md = {}
@@ -48,7 +55,7 @@ local function generateFunctionMarkdown(class, functions)
if p.optional then paramLine = paramLine .. " *(optional)*" end if p.optional then paramLine = paramLine .. " *(optional)*" end
paramLine = paramLine .. " `" .. p.type .. "`" paramLine = paramLine .. " `" .. p.type .. "`"
if p.description and p.description ~= "" then if p.description and p.description ~= "" then
paramLine = paramLine .. " " .. p.description paramLine = paramLine .. " " .. escapeInlineCode(p.description)
end end
table.insert(md, paramLine) table.insert(md, paramLine)
end end
@@ -63,7 +70,7 @@ local function generateFunctionMarkdown(class, functions)
returnLine = returnLine .. " `" .. r.name .. "`" returnLine = returnLine .. " `" .. r.name .. "`"
end end
if r.description and r.description ~= "" then if r.description and r.description ~= "" then
returnLine = returnLine .. " " .. r.description returnLine = returnLine .. " " .. escapeInlineCode(r.description)
end end
table.insert(md, returnLine) table.insert(md, returnLine)
end end