Markdown changes

This commit is contained in:
Robert Jelic
2025-03-18 01:51:37 +01:00
parent 7e2d186837
commit 2dc08bc3a3
2 changed files with 26 additions and 2 deletions

View File

@@ -169,6 +169,13 @@ local function createTableFromNode(node, scope)
end
local BaseElement = {}
--- Generates this element from XML nodes
--- @shortDescription Generates this element from XML nodes
--- @param self BaseElement The element to generate from XML nodes
--- @param node table The XML nodes to generate from
--- @param scope table The scope to use
--- @return BaseElement self The element instance
function BaseElement:fromXML(node, scope)
if(node.attributes)then
for k, v in pairs(node.attributes) do
@@ -230,6 +237,13 @@ function BaseElement:fromXML(node, scope)
end
local Container = {}
--- Loads an XML string and parses it into the element
--- @shortDescription Loads an XML string and parses it into the element
--- @param self Container The element to load the XML into
--- @param nodes string The XML string to load
--- @param scope table The scope to use
--- @return Container self The element instance
function Container:loadXML(content, scope)
scope = scope or {}
local nodes = XMLParser.parseText(content)
@@ -246,6 +260,12 @@ function Container:loadXML(content, scope)
return self
end
--- Generates this element from XML nodes
--- @shortDescription Generates this element from XML nodes
--- @param self Container The element to generate from XML nodes
--- @param nodes table The XML nodes to generate from
--- @param scope table The scope to use
--- @return Container self The element instance
function Container:fromXML(nodes, scope)
BaseElement.fromXML(self, nodes, scope)
if(nodes.children)then

View File

@@ -314,6 +314,10 @@ local function markdownEvents(className)
return output
end
local function formatLink(str)
return str:lower():gsub("[()]", ""):gsub("[:.]+", "-")
end
local function markdownClassFunctionList(className)
if(#markdown.blocks<=0)then
return ""
@@ -333,7 +337,7 @@ local function markdownClassFunctionList(className)
local output = "\n## 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 .. ")|"
output = output .. "|[" .. block.func .. "](#" .. formatLink(block.func) .. ")|"
if(block["return"]~=nil)then
local returnType = block["return"][1]:match("^(%S+)")
output = output .. returnType.."|"
@@ -369,7 +373,7 @@ local function markdownProtectedFunctions(className)
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 .. ")|"
output = output .. "|"..block.func.."|"
if(block["return"]~=nil)then
local returnType = block["return"][1]:match("^(%S+)")
output = output .. returnType.."|"