libelektra: inconsistent "comment" handling for ini and hosts plugin
The ini and hosts plugin handle “comments” differently.
The hosts plugin conforms to the metadata defined in METADATA.ini, however, ini handles comments differently. So for the following ini-file
# header
# comment
setting = value
the ini plugin will generate this meta data for setting key:
key 'user/test/puppet-test-ini/setting'
string value: value
meta data keys: 8
comments: #2
comments/#0: # header
comments/#1:
comments/#2: # comment
internal/ini/key/last: #0
internal/ini/key/number: #0
internal/ini/order: #0
internal/ini/parent: user/test/puppet-test-ini
Issues/differences to METADATA.ini:
comments, notcommentcomment/startnot implemented/used- comment character
#included in the value of the comment key
It would be very nice, if the ini plugin also implements the behaviour as defined in METADATA.ini, especially not adding the comment char ‘#’ to the actual value of the metadata key.
Maybe related to #1355
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (13 by maintainers)
The XML example is quite interesting. From my point of view it’s better to treat blocks of comments as one comment. So generate one ‘comment’ metakey for each comment block. I think XML parsers also treat it this way. So for the above XML example, I would suggest to generate something like:
Line wise parsers could treat comments line wise.
But I think XML has an additional interesting case:
where to place ‘comment2’ comment?
If I understood @fberlakovich correctly,
spacedescribes the whitespace before the comment char e.g.#and is therefore more important for inline comments? But I think it’s simpler to more intuitive to preserve the whitespace chars as they are, instead of counting them.And the
startkey holds the comment char + whitespace between this comment char and the first non-whitespace comment?Yes, I think there is nothing wrong with it. I found this problem, since I’m implementing a ‘comments’ parameter for my puppet module.