Added init fix and small markdown changes
This commit is contained in:
@@ -81,6 +81,10 @@ end
|
|||||||
--- @return table self The initialized instance
|
--- @return table self The initialized instance
|
||||||
--- @protected
|
--- @protected
|
||||||
function BaseElement:init(props, basalt)
|
function BaseElement:init(props, basalt)
|
||||||
|
if self._initialized then
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
self._initialized = true
|
||||||
self._props = props
|
self._props = props
|
||||||
self._values.id = uuid()
|
self._values.id = uuid()
|
||||||
self.basalt = basalt
|
self.basalt = basalt
|
||||||
@@ -122,6 +126,10 @@ end
|
|||||||
--- @return table self The BaseElement instance
|
--- @return table self The BaseElement instance
|
||||||
--- @protected
|
--- @protected
|
||||||
function BaseElement:postInit()
|
function BaseElement:postInit()
|
||||||
|
if self._postInitialized then
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
self._postInitialized = true
|
||||||
if(self._props)then
|
if(self._props)then
|
||||||
for k,v in pairs(self._props)do
|
for k,v in pairs(self._props)do
|
||||||
self.set(k, v)
|
self.set(k, v)
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ function Container:addChild(child)
|
|||||||
|
|
||||||
table.insert(self._values.children, child)
|
table.insert(self._values.children, child)
|
||||||
child.parent = self
|
child.parent = self
|
||||||
|
child:postInit()
|
||||||
self.set("childrenSorted", false)
|
self.set("childrenSorted", false)
|
||||||
self:registerChildrenEvents(child)
|
self:registerChildrenEvents(child)
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -411,8 +411,6 @@ Animation.registerAnimation("scrollText", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
---@splitClass
|
|
||||||
|
|
||||||
--- Adds additional methods for VisualElement when adding animation plugin
|
--- Adds additional methods for VisualElement when adding animation plugin
|
||||||
--- @class VisualElement
|
--- @class VisualElement
|
||||||
local VisualElement = {hooks={}}
|
local VisualElement = {hooks={}}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ local themes = {
|
|||||||
default = defaultTheme
|
default = defaultTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---@title title
|
||||||
|
|
||||||
local currentTheme = "default"
|
local currentTheme = "default"
|
||||||
|
|
||||||
--- This is the theme plugin. It provides a theming system that allows for consistent styling across elements
|
--- This is the theme plugin. It provides a theming system that allows for consistent styling across elements
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ local commentTypes = {
|
|||||||
"protected",
|
"protected",
|
||||||
"field",
|
"field",
|
||||||
"vararg",
|
"vararg",
|
||||||
"splitClass"
|
"splitClass",
|
||||||
|
"title"
|
||||||
}
|
}
|
||||||
|
|
||||||
local function extractComment(line)
|
local function extractComment(line)
|
||||||
@@ -64,13 +65,13 @@ local function getFunctionName(line)
|
|||||||
return line:match(pattern)
|
return line:match(pattern)
|
||||||
end
|
end
|
||||||
|
|
||||||
function markdown.parse(content)
|
function markdown.parse(content, file)
|
||||||
local blocks = {}
|
local blocks = {}
|
||||||
local properties = {}
|
local properties = {}
|
||||||
local combinedProperties = {}
|
local combinedProperties = {}
|
||||||
local events = {}
|
local events = {}
|
||||||
local fields = {}
|
local fields = {}
|
||||||
local currentBlock = {type = "comment", desc = {}}
|
local currentBlock = {type = "comment", desc = {}, file = file}
|
||||||
local skipNextFunction = false
|
local skipNextFunction = false
|
||||||
local currentClass = "None"
|
local currentClass = "None"
|
||||||
local splitNextClass = false
|
local splitNextClass = false
|
||||||
@@ -79,7 +80,7 @@ function markdown.parse(content)
|
|||||||
if line:match("^%s*$") or line == "" then
|
if line:match("^%s*$") or line == "" then
|
||||||
if hasBlockContent(currentBlock) then
|
if hasBlockContent(currentBlock) then
|
||||||
table.insert(blocks, currentBlock)
|
table.insert(blocks, currentBlock)
|
||||||
currentBlock = {type = "comment", desc = {}}
|
currentBlock = {type = "comment", desc = {}, file = file}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local comment, isDoc = extractComment(line)
|
local comment, isDoc = extractComment(line)
|
||||||
@@ -94,6 +95,9 @@ function markdown.parse(content)
|
|||||||
splitNextClass = true
|
splitNextClass = true
|
||||||
elseif(commentType == "protected")then
|
elseif(commentType == "protected")then
|
||||||
currentBlock.protected = true
|
currentBlock.protected = true
|
||||||
|
elseif(commentType == "title")then
|
||||||
|
currentBlock.title = value
|
||||||
|
currentBlock.type = "title"
|
||||||
else
|
else
|
||||||
if(commentType == "module")then
|
if(commentType == "module")then
|
||||||
currentBlock.usageIsActive = false
|
currentBlock.usageIsActive = false
|
||||||
@@ -435,6 +439,13 @@ local function markdownClass(block)
|
|||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function markdownClassGroup(blocks)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local log = require("Basalt2/src/log")
|
||||||
|
log._enabled = true
|
||||||
|
log._logToFile = true
|
||||||
function markdown.makeMarkdown()
|
function markdown.makeMarkdown()
|
||||||
local classes = {}
|
local classes = {}
|
||||||
local output = ""
|
local output = ""
|
||||||
@@ -447,6 +458,7 @@ function markdown.makeMarkdown()
|
|||||||
output = output .. markdownModule(block)]]
|
output = output .. markdownModule(block)]]
|
||||||
elseif block.type == "class" then
|
elseif block.type == "class" then
|
||||||
classes[block.className] = {content=markdownClass(block), data=block}
|
classes[block.className] = {content=markdownClass(block), data=block}
|
||||||
|
log.debug("Class found: " .. block.className)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -462,7 +474,7 @@ function markdown.parseFile(source)
|
|||||||
local input = file:read("*a")
|
local input = file:read("*a")
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
return markdown.parse(input)
|
return markdown.parse(input, source)
|
||||||
end
|
end
|
||||||
|
|
||||||
function markdown.saveToFile(source, output)
|
function markdown.saveToFile(source, output)
|
||||||
|
|||||||
Reference in New Issue
Block a user