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

jsonnet fmt --string-style s does not escape single quotes in strings #197

Closed
brbbs opened this issue May 27, 2016 · 1 comment
Closed

Comments

@brbbs
Copy link
Contributor

brbbs commented May 27, 2016

jsonnet fmt --string-style s (the single quote option) creates invalid jsonnet if a string has a single quote inside it.

Given a foo.jsonnet:

{
  foo: "'bar'",
  bar: '\'baz\'',
}

jsonnet fmt --string-style s produces:

$ jsonnet fmt --string-style s foo.jsonnet | tee foo.jsonnet
{
  foo: ''bar'',
  bar: ''baz'',
}

Which of course is invalid jsonnet:

$ jsonnet foo.jsonnet
STATIC ERROR: foo.jsonnet:2:10-12: Expected a comma before next field.
@brbbs brbbs changed the title jsonnet fmt --single-space s does not escape single quotes in strings jsonnet fmt --string-style s does not escape single quotes in strings May 27, 2016
@sparkprime
Copy link
Member

Sorry for the slow response, output is now:

$ jsonnet fmt --string-style s foo.jsonnet 
{
  foo: "'bar'",
  bar: "'baz'",
}

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