-
Notifications
You must be signed in to change notification settings - Fork 17
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
Hyphens in key names (dumper) #37
Comments
The quoting is done just to avoid ambiguity because some scalars can be misinterpreted to be something else.
when dumped without quotes, it will give us the following YAML output.
This output will be misinterpreted to be To avoid such quoting, you can make a new custom
Now the dump YAML files will not have |
@vijayphoenix would it be possible to detect more accurately when quoting is necessary? i.e. when the presence of hyphens in a string doesn't require quoting as there's no grammar ambiguity? |
Thanks, that makes sense. I know that a hyphen at the beginning of the key name requires quoting, but an internal one should be okay, I believe, and these are quite common. They even occur in examples in the YAML spec documentation. Ideally HsYAML would make that distinction and avoid the unnecessary quoting. (You guys are the experts on the YAML spec, though! There may be something I'm missing.) |
Yeah, we could definitely improve in this area. |
and
plus whitespace of course. |
I've been trying out dumping YAML from the structure we use to represent pandoc command-line options (with HsYAML-aeson).
I'm getting this:
Keys with hyphens are quoted. This isn't necessary in YAML, so the quotes are overkill and undesirable. Can the code that determines when a key name needs quoting be tweaked to make it less aggressive? (I could take a look if you point me to the right place in the code.)
I'm assuming this is an issue with HsYAML itself rather than HsYAML-aeson.
[EDIT: fixed YAML nomenclature]
The text was updated successfully, but these errors were encountered: