Refactor XML parser #82

Merged
thesabinelim merged 10 commits from xml-parser-refactor into master 2023-05-16 21:07:42 +08:00
Showing only changes of commit 4b029c9728 - Show all commits

View File

@@ -28,11 +28,11 @@ local XMLNode = {
}
local parseAttributes = function(node, s)
-- Parse "" style attributes
-- Parse "" style string attributes
local _, _ = string.gsub(s, "(%w+)=([\"'])(.-)%2", function(attribute, _, value)
node:addAttribute(attribute, "\"" .. value .. "\"")
end)
-- Parse {} style attributes
-- Parse {} style computed attributes
local _, _ = string.gsub(s, "(%w+)={(.-)}", function(attribute, expression)
node:addAttribute(attribute, expression)
end)