yaml.js icon indicating copy to clipboard operation
yaml.js copied to clipboard

Barfs on multiple lines

Open jmls opened this issue 9 years ago • 7 comments

this yml

options:
- list: foo
  url: bar
tasks:
- Task: 5559
  Title: New task
  Description: |
    Added comment....

    Multiple lines

  TaskStatusValue: Not Started

parses on http://yaml-online-parser.appspot.com/

but crashes out using yamljs with the error

TypeError: vaule.indexOf is not a function

jmls avatar Aug 15 '16 15:08 jmls

Possibly related issues I'm seeing:

  1. if you have a completely blank newline underneath a multiline string then it throws a parse error, if you add at least one whitespace char it no longer fails to parse. This fails:
test: |
  example

  with a blank newline above

This will parse:

test: |
  example

  with a newline with whitespace above
  1. If you have a multiline string without one of the multiline indicators it fails to parse but its valid YAML. This explains all the multiline options in pretty good detail http://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines
 myarray:
- example multiline
  FAILS

jwforres avatar Sep 01 '16 13:09 jwforres

Why is this closed?

pomle avatar Sep 20 '16 09:09 pomle

Thanks for the details.

This issue is definitely not closed and will be reviewed as soon as I get a moment for that!

jeremyfa avatar Sep 20 '16 10:09 jeremyfa

I'm having the same issue with parsing multi line strings using v0.2.8 using two different examples.

For https://storage.googleapis.com/kubernetes-charts/index.yaml (attached also) It fails on lines 462-463

description: A Spartakus Helm chart for Kubernetes. Spartakus aims to collect
  information about Kubernetes clusters.

That file is generated by a YAML parser/linter written in GO (used by Kubernetes). There is a newline and then two more spaces than the "description" indent in that second line. The same happens when users have multilines split by using "" (see fabric8 file sample)

The error is: message: 'Unable to parse.', parsedLine: 463, snippet: ' information about Kubernetes clusters.'

index.yaml.zip fabric8-helmv2-index.yaml.zip

sputnick avatar Oct 25 '16 22:10 sputnick

Any updates on this issue? Experiencing it as well.

mhamann avatar Mar 14 '17 03:03 mhamann

Same issue, still in 2022.

Happens with the | format, as originally reported, as well as something like:

description:
  A description of the error, primarily for internal use.  Only error codes should be used
  (which must be specific and localized for the frontend).

ncovercash avatar Mar 08 '22 21:03 ncovercash

Hi, I don’t actively work on yaml.js as explained in the README, but pull requests are welcome, still in 2022.

jeremyfa avatar Mar 09 '22 09:03 jeremyfa