mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
YAML: Serialize nodes properly
This fixes the error where a YamlList is not of type string.
This commit is contained in:
@ -86,7 +86,8 @@ class MarkdownYAMLSerializer implements NoteSerializer {
|
|||||||
var str = "";
|
var str = "";
|
||||||
|
|
||||||
map.forEach((key, value) {
|
map.forEach((key, value) {
|
||||||
str += key + ": " + value + "\n";
|
String val = value.toString();
|
||||||
|
str += key + ": " + val + "\n";
|
||||||
});
|
});
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,20 @@ created: 2017-02-15T22:41:19+01:00
|
|||||||
foo: bar
|
foo: bar
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Alright.""";
|
||||||
|
|
||||||
|
var serializer = MarkdownYAMLSerializer();
|
||||||
|
var note = serializer.decode(str);
|
||||||
|
var actualStr = serializer.encode(note);
|
||||||
|
|
||||||
|
expect(actualStr, str);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Markdown Serializer YAML Lists', () {
|
||||||
|
var str = """---
|
||||||
|
foo: [bar, gar]
|
||||||
|
---
|
||||||
|
|
||||||
Alright.""";
|
Alright.""";
|
||||||
|
|
||||||
var serializer = MarkdownYAMLSerializer();
|
var serializer = MarkdownYAMLSerializer();
|
||||||
|
Reference in New Issue
Block a user