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

Incorrect handling of block scalars #132

Open
bwilkerson opened this issue Dec 5, 2022 · 3 comments
Open

Incorrect handling of block scalars #132

bwilkerson opened this issue Dec 5, 2022 · 3 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bwilkerson
Copy link
Member

When a block scalar using both folded and strip (>-) is processed, the newlines do not appear to be replaced by spaces. I haven't tested to see whether other forms of folded scalars are handled correctly.

@jonasfj
Copy link
Member

jonasfj commented Jun 7, 2024

FYI @kekavc24, I suppose we should investigate this.

I mean, if package:yaml_edit produces folded strings correctly and package:yaml parses them incorrectly, that'd probably cause some of our tests to fail 🙈

note to self: there is nice documentation of multi-line YAML strings at https://yaml-multiline.info/

@jonasfj jonasfj added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jun 7, 2024
@kekavc24
Copy link

kekavc24 commented Jun 7, 2024

I think this issue should be closed. package: yaml does the right thing.

print(
    loadYaml('''
>-
  foo
  bar
''',
    ),
  ); // Prints "foo bar"


print(
    loadYaml('''
>-
  foo

  bar
''',
    ),
  ); // Prints "foo\nbar"

@kekavc24
Copy link

kekavc24 commented Jun 7, 2024

note to self: there is nice documentation of multi-line YAML strings at https://yaml-multiline.info/

@jonasfj Indeed. 😅 What actually fails are the indentation indicators. Maybe he included them? I thought we could use them for strings with leading spaces but encountered an error from package: yaml for the fix in some cases. Had to fallback to double quotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants