mustangostang / spyc

A simple YAML loader/dumper class for PHP
MIT License
701 stars 206 forks source link

Multi-line scalars strip trailing whitespace. #54

Open jasonvarga opened 7 years ago

jasonvarga commented 7 years ago

Given something like this:

foo: |
  line one..
  line two

(The .. at the end of line one represents spaces.)

When parsing, those spaces get stripped.

The trailing whitespace is important, especially when you indent on parsing that string with something like Markdown after. Two spaces at the end of a line indicates a <br>.

In earlier versions of Spyc, this never happened.

TimOetting commented 5 years ago

It seems to have the same problem with lines at the beginning of lines.

foo: |
  line one
    line two

ends up in

foo: |
  line one
  line two