Note: Replace 'id' with 'fileName'

It all just makes far more since when each Note has a fileName.

Though we don't save the fileName in the YAML header. It seems quite
redundant to do that.

Another advantage of this is that if we can read any file ending with a
'.md' in a git repo. It doesn't need to be named exactly how we want it,
and we will still save the details correctly.
This commit is contained in:
Vishesh Handa
2019-01-18 16:00:44 +01:00
parent 99392955c9
commit c99fe854a1
8 changed files with 37 additions and 51 deletions

View File

@ -48,13 +48,7 @@ class MarkdownYAMLSerializer implements NoteSerializer {
var metadata = note.toJson();
metadata.remove('body');
// Do not save the 'id' if it is just the 'created' file like default
if (metadata.containsKey('id') && metadata.containsKey('created')) {
if (metadata['id'] == metadata['created']) {
metadata.remove('id');
}
}
metadata.remove('fileName');
str += toYAML(metadata);
str += serparator;