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

Strings with values that could be interpreted as scalars should be encoded with quotes #31

Closed
jgm opened this issue Oct 6, 2013 · 3 comments

Comments

@jgm
Copy link
Contributor

jgm commented Oct 6, 2013

Prelude Data.ByteString Data.Yaml> decode (encode (String "True")) :: Maybe Value
Just (Bool True)

Proposal: String "True" should be encoded with single quotes, as

'True'

rather than

True

And similarly for any string that matches the pattern for Booleans:
y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF.

snoyberg added a commit that referenced this issue Oct 7, 2013
@snoyberg
Copy link
Owner

snoyberg commented Oct 7, 2013

Good call, I've pushed a commit with this change. Can you confirm it addresses your case?

@jgm
Copy link
Contributor Author

jgm commented Oct 7, 2013

It does, thank you! I'm getting output like this:

    family: !!str 'True'

instead of the nicer and equally good

    family: 'True'

but it's not a big deal if for some reason the !!str is necessary.

snoyberg added a commit that referenced this issue Oct 7, 2013
@snoyberg
Copy link
Owner

snoyberg commented Oct 7, 2013

No reason, I just forgot about the details of how the underlying libyaml works. Should be fixed now.

joshado pushed a commit to joshado/pkgsrc-wip that referenced this issue Nov 6, 2013
changes:
0.8.5.1
 - Get rid of tags for TritonDataCenter#31
 - Round tripping of special strings TritonDataCenter#31
     ( TritonDataCenter#31 => snoyberg/yaml#31 )
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

2 participants