diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2015-01-13 01:25:09 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2015-01-13 01:25:09 +0100 |
commit | af668b4c83692ca8556d0aed97a3c542f7176e75 (patch) | |
tree | eeb76f7ca4855dd9cc9743439c142b60ec294da8 /lib/psych/visitors/yaml_tree.rb | |
parent | 9a811d65852fa3fd556c475652c321263d148edd (diff) | |
download | psych-af668b4c83692ca8556d0aed97a3c542f7176e75.zip |
Fix block chomping and add more tests
When no [chomping indicator][1] is specified for a folded or literal
block, then YAML parser should preserve the final line break (i.e. the
string should end with \n). This implies that when dumping a string
*without* the trailing newline to YAML, we should specify the stripping
indicator (-).
[1]: http://yaml.org/spec/1.2/2009-07-21/spec.html#id2593651
Diffstat (limited to 'lib/psych/visitors/yaml_tree.rb')
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index ba1ac13..f6427ce 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -319,7 +319,6 @@ module Psych quote = false elsif @line_width && o.length > @line_width style = Nodes::Scalar::FOLDED - o += "\n" unless o =~ /\n\Z/ # to avoid non-default chomping indicator elsif o =~ /^[^[:word:]][^"]*$/ style = Nodes::Scalar::DOUBLE_QUOTED elsif not String === @ss.tokenize(o) |