This repository was archived by the owner on Feb 10, 2025. It is now read-only.
Commit 7ed8618 1 parent 2a9a11b commit 7ed8618 Copy full SHA for 7ed8618
File tree 4 files changed +25
-2
lines changed
4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.2.1
2
+ - Fix inconsistent line endings when inserting maps into a document using ` \r\n ` .
3
+ ([ #65 ] ( https://github.com/dart-lang/yaml_edit/issues/65 ) )
4
+
1
5
## 2.2.0
2
6
- ` AliasError ` is changed to ` AliasException ` and exposed in the public API.
3
7
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ String yamlEncodeBlockString(
274
274
/// Empty collections are always encoded in flow-style, so new-line must
275
275
/// be avoided
276
276
if (isCollection (entry.value) && ! isEmpty (entry.value)) {
277
- return '$formattedKey :\n $formattedValue ' ;
277
+ return '$formattedKey :$ lineEnding $formattedValue ' ;
278
278
}
279
279
280
280
return '$formattedKey : $formattedValue ' ;
Original file line number Diff line number Diff line change 1
1
name : yaml_edit
2
- version : 2.2.0
2
+ version : 2.2.1
3
3
description : A library for YAML manipulation with comment and whitespace preservation.
4
4
repository : https://github.com/dart-lang/yaml_edit
5
5
issue_tracker : https://github.com/dart-lang/yaml_edit/issues
Original file line number Diff line number Diff line change @@ -167,6 +167,25 @@ c: 3\r
167
167
expectYamlBuilderValue (doc, []);
168
168
});
169
169
170
+ test ('inserted nested map' , () {
171
+ final doc = YamlEditor ('''
172
+ a:\r
173
+ b:\r
174
+ ''' );
175
+ doc.update (
176
+ ['a' , 'b' ],
177
+ {
178
+ 'c' : {'d' : 'e' }
179
+ },
180
+ );
181
+ expect (doc.toString (), equals ('''
182
+ a:\r
183
+ b:\r
184
+ c:\r
185
+ d: e\r
186
+ ''' ));
187
+ });
188
+
170
189
test ('remove from block map' , () {
171
190
final doc = YamlEditor ('''
172
191
a: 1\r
You can’t perform that action at this time.
0 commit comments