Rewrote the output so that it emits correct YAML.

Fixed a bug in the last newline of a block folded scalar.
This commit is contained in:
beder
2008-07-05 05:28:23 +00:00
parent 5feaef3748
commit ba97c9f719
12 changed files with 98 additions and 145 deletions

View File

@@ -110,7 +110,12 @@ namespace YAML
bool nextMoreIndented = (INPUT.peek() == ' ');
// for block scalars, we always start with a newline, so we should ignore it (not fold or keep)
if(pastOpeningBreak) {
bool useNewLine = pastOpeningBreak;
// and for folded scalars, we don't fold the very last newline to a space
if(params.fold && !emptyLine && INPUT.column < params.indent)
useNewLine = false;
if(useNewLine) {
if(params.fold && !emptyLine && !nextEmptyLine && !moreIndented && !nextMoreIndented)
scalar += " ";
else