mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +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 = "";
|
||||
|
||||
map.forEach((key, value) {
|
||||
str += key + ": " + value + "\n";
|
||||
String val = value.toString();
|
||||
str += key + ": " + val + "\n";
|
||||
});
|
||||
return str;
|
||||
}
|
||||
|
@ -57,6 +57,20 @@ created: 2017-02-15T22:41:19+01:00
|
||||
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.""";
|
||||
|
||||
var serializer = MarkdownYAMLSerializer();
|
||||
|
Reference in New Issue
Block a user