Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anymarkup does not support comments #5

Open
vpavlin opened this issue Aug 13, 2015 · 3 comments
Open

Anymarkup does not support comments #5

vpavlin opened this issue Aug 13, 2015 · 3 comments

Comments

@vpavlin
Copy link

vpavlin commented Aug 13, 2015

For formats where it's possible, we would like to be able to add comments to files generated by anymarkup.

See: projectatomic/atomicapp#178

@bkabrda
Copy link
Owner

bkabrda commented Aug 14, 2015

Heh, so this is interesting. The biggest issue here is that a comment is actually a syntactic element in XML. There's no real syntax for INI files, but most INI parsers also recognize INI comments.
For JSON and Yaml, this would be much more complicated. In fact, the Yaml specification forbids parsing comments altogether [1].

It should be possible to provide comments serialization in XML and INI and ignore these in Yaml and JSON. I'd have to rewrite the INI parsing logic first to return OrderedDict, but that shouldn't be a big deal; XML parsing already returns that. Then I'd have to decide on a special key in the returned structures that would represent comments, something like #comment-follows-this-is-very-unique-so-we-can-be-sure-noone-actually-uses-that-as-key. Or similar :)

I think this should also be an argument for API functions to explicitly say that I want/don't want to parse/serialize comments.

Would that that sufficient for you?

[1] http://yaml.org/spec/current.html#comment/information%20model

@dustymabe
Copy link

@bkabrda +1 to your proposal.

Would it be possible to read INI files with comments as well as write out comments?

@bkabrda
Copy link
Owner

bkabrda commented Jan 6, 2016

Yeah, absolutely. I'll try to get to this ASAP, but unfortunately I have no idea when that'll be.

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

No branches or pull requests

3 participants