Fix line folding (dart-lang/yaml_edit#87)

* Fix line folding to match specification

* Add test case and remove TODO for fix

* Remove indent creation from utility function

* Update changelog

* Return null if strings cannot be encoded in desired `ScalarStyle`

> Fix invalid encoding for string with trailing line breaks or white-space

* Clean up code

> Update `_tryYamlEncodedPlain` to return null if string cannot be encoded
> Make `_yamlEncodeFlowScalar` and `yamlEncodeBlockScalar` code concise

* Remove unnecessary assertions and add docs

> `_yamlEncodeFlowScalar` and `_yamlEncodeBlockScalar` always encode YamlScalars

* Minor refactoring

* Fix condition check for encoding as literal/folded

* Remove keep chomping indicator references

* Update lib/src/strings.dart

---------

Co-authored-by: Jonas Finnemann Jensen <jonasfj@google.com>
Co-authored-by: Jonas Finnemann Jensen <jopsen@gmail.com>
6 files changed
tree: 71785dfc383f99bf0ce20fdf2d1b08c240aacd75
  1. pkgs/