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

Are multiline values supported? #106

Closed
SimplyDanny opened this issue Feb 18, 2018 · 3 comments
Closed

Are multiline values supported? #106

SimplyDanny opened this issue Feb 18, 2018 · 3 comments

Comments

@SimplyDanny
Copy link

I wonder whether multiline values like

key: |
    value1
    value2

are supported by your library. I always get parse errors trying to read such YAML files.

@jpsim
Copy link
Owner

jpsim commented Feb 18, 2018

What parse errors are you getting? Yes, multiline strings with the syntax you shared are supported by Yams.

@jpsim
Copy link
Owner

jpsim commented Feb 18, 2018

Here's a small sample program demonstrating how this is parsed:

let yaml = """
  key: |
    value1
    value2
  """
let parsedYAML = try! Yams.load(yaml: yaml)!
print(parsedYAML)
// Prints:
// [AnyHashable("key"): "value1\nvalue2"]

@SimplyDanny
Copy link
Author

Oh, thank you! It turned out that it was just my inability to write YAML files correctly. Sorry for that.

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