ingydotnet / yaml-libyaml-pm

Perl Binding to libyaml
http://search.cpan.org/dist/YAML-LibYAML/
33 stars 37 forks source link

Add heuristic for multiline literals #23

Closed mbethke closed 9 years ago

mbethke commented 9 years ago

Strings with embedded newlines get dumped in double quoted style if they are at most 30 characters long, otherwise in multiline literal style.

I think I somewhat screwed up the indentation because I didn't get the style :) Also there's a small optimization that avoids making a copy of the string if its UTF8 flag is unset but it is empty, "true" etc. where by definition it doesn't make a difference. As I didn't get how the test suite works either I couldn't really verify it or update the tests but it seems to work the same as YAML.pm now.

ingydotnet commented 9 years ago

Applied. Released. Thanks.

Needed to fix a test, and then added a couple new tests.