yaml-test-suite icon indicating copy to clipboard operation
yaml-test-suite copied to clipboard

Document end marker after every open ended document?

Open perlpunk opened this issue 5 years ago • 1 comments

See also #49

If we have an open ended block scalar at the end of the stream:

keep: |+
  line1


It should be emitted as:

keep: |+
  line1


...

But maybe this rule should not only be for the last document in a stream, but for every document, which is especially important in streaming context:

---
keep: |+
  line1


--- doc two

Every document should be able to taken out of a stream and represent the same. If you take it out and accidentally add a newline, then it has one more empty line.

So when emitting the above documents, the output should look like this:

---
keep: |+
  line1


...
--- doc two

What do you think? @ingydotnet @hvr @eemeli @pantoniou @am11

Note: This rule is for emitters. The marker would not be required when parsing.

Note 2: Open-ended only means block scalars with trailing empty lines (|+, >+). I know that in YAML 1.1 open-ended has a slightly different meaning.

perlpunk avatar Dec 28 '19 13:12 perlpunk

@perlpunk I think this should include blank lines as well. ie any trailing lines without visible characters.

ingydotnet avatar Dec 30 '19 05:12 ingydotnet