From e10d3c1ae8fc3042b515724772e90c701d31a8a3 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sun, 14 Sep 2025 12:11:09 +0200 Subject: [PATCH] Private/Protected Markdown fix, added run for bigfont --- src/elements/BigFont.lua | 7 +++-- tools/BasaltDoc/utils/markdownGenerator.lua | 34 +++++++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/elements/BigFont.lua b/src/elements/BigFont.lua index 7fa9e07..f83bd35 100644 --- a/src/elements/BigFont.lua +++ b/src/elements/BigFont.lua @@ -146,8 +146,11 @@ local VisualElement = elementManager.getElement("VisualElement") ---@configDefault false --- The BigFont element is a text element that displays larger text. It uses Wojbie's BigFont API to render the text in a larger font size. Credits to Wojbie for the original API. ---- @usage local font = main:addBigFont() ---- @usage font:setText("Hello World!") +--- @run local basalt = require("basalt") +--- @run local main = basalt.getMainFrame() +--- @run local font = main:addBigFont() +--- @run font:setText("Hello World!") +--- @run basalt.run() ---@class BigFont : VisualElement local BigFont = setmetatable({}, VisualElement) BigFont.__index = BigFont diff --git a/tools/BasaltDoc/utils/markdownGenerator.lua b/tools/BasaltDoc/utils/markdownGenerator.lua index 8d4ee79..e9a73ee 100644 --- a/tools/BasaltDoc/utils/markdownGenerator.lua +++ b/tools/BasaltDoc/utils/markdownGenerator.lua @@ -5,7 +5,6 @@ local function processDescription(description) local lines = {} for line in description:gmatch("([^\n]*)\n?") do if line ~= "" then - -- URLs in Markdown-Links umwandeln line = line:gsub("https?://[^%s]+", function(url) return "[" .. url .. "](" .. url .. ")" end) @@ -192,13 +191,21 @@ function markdownGenerator.generate(ast) end if not class.skipFunctionList and #class.functions > 0 then - table.insert(md, "## Functions") - table.insert(md, "") - table.insert(md, "|Method|Returns|Description|") - table.insert(md, "|---|---|---|") - + local publicFunctions = {} for _, f in ipairs(class.functions) do - local methodName = (class.name or "") .. (f.static and "." or ":") .. (f.name or "") + if f.visibility ~= "private" and f.visibility ~= "protected" then + table.insert(publicFunctions, f) + end + end + + if #publicFunctions > 0 then + table.insert(md, "## Functions") + table.insert(md, "") + table.insert(md, "|Method|Returns|Description|") + table.insert(md, "|---|---|---|") + + for _, f in ipairs(publicFunctions) do + local methodName = (class.name or "") .. (f.static and "." or ":") .. (f.name or "") local anchor = methodName:lower() if #f.params > 0 then @@ -223,13 +230,14 @@ function markdownGenerator.generate(ast) anchor, returnType, shortDesc)) - end - table.insert(md, "") + end + table.insert(md, "") - if not class.skipDetailedFunctionList then - local functionMd = generateFunctionMarkdown(class, class.functions) - for _, line in ipairs(functionMd) do - table.insert(md, line) + if not class.skipDetailedFunctionList then + local functionMd = generateFunctionMarkdown(class, publicFunctions) + for _, line in ipairs(functionMd) do + table.insert(md, line) + end end end end