Skip to content

Conversation

@Imisnew2
Copy link
Contributor

I wanted to add comments to CDATA sections I manually added to a config file. This was giving me a 'malformed config' error, so I tried to fix the config library to allow this.

Comment on lines +294 to -292
if node.children:any(function(n) return n.cdata end) then
meta.cdata:add(key)
return val
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what meta.cdata is tracking or what features it supports. I just added the key once if any of the text nodes had cdata. Before, it was asserting only one node could exist, so the condition used to be a simple 'if that one node has cdata' instead of 'if any node has cdata'.

local val = ''
for child in node.children:it() do
if child.type == 'comment' then
meta.comments[key] = child.value:trim()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was copied from what the other code path does -- the path when all children are tags or comments. Though it seems like this just ends up taking the value of the last comment vs storing all the comments. I don't know what meta.comments is used for.

@Imisnew2 Imisnew2 force-pushed the imisnew-config-multiple-text-children branch from 2ab9ee4 to a1dde86 Compare November 28, 2022 23:55
@Nifim Nifim merged commit 89a560f into Windower:dev Dec 2, 2022
z16 pushed a commit that referenced this pull request Nov 4, 2024
…hildren

Config: Allow multiple 'text' children in a single XML tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants