Separated protected functions from public functions
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
-- Will temporary exist so that we don't lose track of how the plugin system works
|
||||
|
||||
local VisualElement = {hooks={init={}}}
|
||||
|
||||
-- Called on Class level to define properties and setup before instance is created
|
||||
function VisualElement.setup(element)
|
||||
element.defineProperty(element, "testProp", {default = 5, type = "number"})
|
||||
end
|
||||
|
||||
-- Hooks into existing methods (you can also use init.pre or init.post)
|
||||
function VisualElement.hooks.init(self)
|
||||
--self.basalt.LOGGER.debug("VisualElement initialized")
|
||||
end
|
||||
|
||||
-- Adds a new method to the class
|
||||
function VisualElement:testFunc()
|
||||
--self.basalt.LOGGER.debug("Hello World", self.get("testProp"))
|
||||
end
|
||||
|
||||
return {
|
||||
VisualElement = VisualElement
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local errorManager = require("errorManager")
|
||||
local PropertySystem = require("propertySystem")
|
||||
local log = require("log")
|
||||
|
||||
local protectedNames = {
|
||||
colors = true,
|
||||
|
||||
@@ -14,7 +14,6 @@ local function processFile(inputFile)
|
||||
local outputFile = "build_docs/docs/references/" .. inputFile:match("^src/(.+)"):gsub("%.lua$", "")
|
||||
|
||||
ensureDirectory(outputFile)
|
||||
--print(string.format("Processing: %s -> %s", inputFile, outputFile))
|
||||
|
||||
markdown.saveToFile(outputFile, md)
|
||||
end
|
||||
|
||||
@@ -88,10 +88,12 @@ function markdown.parse(content)
|
||||
if(commentType == "desc") then
|
||||
currentBlock.usageIsActive = false
|
||||
table.insert(currentBlock.desc, value)
|
||||
elseif(commentType == "private")or(commentType == "protected")then
|
||||
elseif(commentType == "private")then
|
||||
skipNextFunction = true
|
||||
elseif(commentType == "splitClass")then
|
||||
splitNextClass = true
|
||||
elseif(commentType == "protected")then
|
||||
currentBlock.protected = true
|
||||
else
|
||||
if(commentType == "module")then
|
||||
currentBlock.usageIsActive = false
|
||||
@@ -318,7 +320,7 @@ local function markdownClassFunctionList(className)
|
||||
end
|
||||
local fList = {}
|
||||
for _, v in pairs(markdown.blocks) do
|
||||
if(v.type=="function")then
|
||||
if(v.type=="function")and(v.protected~=true)then
|
||||
if(v.className==className)then
|
||||
table.insert(fList, v)
|
||||
end
|
||||
@@ -345,6 +347,42 @@ local function markdownClassFunctionList(className)
|
||||
return output
|
||||
end
|
||||
|
||||
local function markdownProtectedFunctions(className)
|
||||
if(#markdown.blocks<=0)then
|
||||
return ""
|
||||
end
|
||||
local fList = {}
|
||||
for _, v in pairs(markdown.blocks) do
|
||||
if(v.type=="function")and(v.protected==true)then
|
||||
if(v.className==className)then
|
||||
table.insert(fList, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
if(#fList<=0)then
|
||||
return ""
|
||||
end
|
||||
local output = "Protected functions can be overwritten."
|
||||
output = "\n## Protected Functions\n\n|Method|Returns|Description|\n|---|---|---|\n"
|
||||
for _, block in pairs(fList) do
|
||||
if block.type == "function" then
|
||||
output = output .. "|[" .. block.func .. "](#" .. block.func .. ")|"
|
||||
if(block["return"]~=nil)then
|
||||
local returnType = block["return"][1]:match("^(%S+)")
|
||||
output = output .. returnType.."|"
|
||||
else
|
||||
output = output .. "-|"
|
||||
end
|
||||
if(block.shortDescription~=nil)then
|
||||
output = output .. block.shortDescription.."\n"
|
||||
else
|
||||
output = output .. "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
local function markdownClass(block)
|
||||
local output = "# ".. block.className.."\n"
|
||||
if(block.usage~=nil)then
|
||||
@@ -368,9 +406,10 @@ local function markdownClass(block)
|
||||
output = output .. markdownCombinedProperties(block.className)
|
||||
output = output .. markdownEvents(block.className)
|
||||
output = output .. markdownClassFunctionList(block.className) .. "\n"
|
||||
output = output .. markdownProtectedFunctions(block.className) .. "\n"
|
||||
for k,v in pairs(markdown.blocks) do
|
||||
if(v.type=="function")then
|
||||
if(v.className==block.className)then
|
||||
if(v.className==block.className)and(v.protected~=true)then
|
||||
output = output .. markdownFunction(v)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user