Skip to content

Commit

Permalink
revert breaking [config] change -- but for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenatorX authored Dec 2, 2022
1 parent d1dc68c commit adfc1f6
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions addons/libs/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,31 +277,19 @@ function settings_table(node, settings, key, meta)
return t
end

local function tag_or_comment(n)
if not node.children:all(function(n)
return n.type == 'tag' or n.type == 'comment'
end
local function text_or_comment(n)
return n.type == 'text' or n.type == 'comment'
end

if not node.children:all(tag_or_comment) and not node.children:all(text_or_comment) then
end) and not (#node.children == 1 and node.children[1].type == 'text') then
error('Malformatted settings file.')
return t
end

-- TODO: Type checking necessary? merge should take care of that.
if #node.children >= 1 and node.children:all(text_or_comment) then
if node.children:any(function(n) return n.cdata end) then
if #node.children == 1 and node.children[1].type == 'text' then
local val = node.children[1].value
if node.children[1].cdata then
meta.cdata:add(key)
end

local val = ''
for child in node.children:it() do
if child.type == 'comment' then
meta.comments[key] = child.value:trim()
elseif child.type == 'text' then
val = val .. child.value
end
return val
end

if val:lower() == 'false' then
Expand Down

0 comments on commit adfc1f6

Please sign in to comment.