yaml / yaml-test-suite

Comprehensive, language independent Test Suite for YAML
MIT License
172 stars 58 forks source link

Document end marker after every open ended document? #50

Open perlpunk opened 4 years ago

perlpunk commented 4 years ago

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.

ingydotnet commented 4 years ago

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