From 78b3561127a477d3e4571b9c0cad4ce2c7b66303 Mon Sep 17 00:00:00 2001 From: Seopril <49238562+Seopril@users.noreply.github.com> Date: Tue, 5 Jan 2021 13:05:32 -0500 Subject: [PATCH] Fix YAML export syntax --- features/format.feature | 6 +++++- jrnl/plugins/yaml_exporter.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/features/format.feature b/features/format.feature index f5156301..dc89a7fe 100644 --- a/features/format.feature +++ b/features/format.feature @@ -410,10 +410,12 @@ Feature: Custom formats """ And the content of file "2020-08-29_entry-the-first.md" in the cache should be """ + --- title: Entry the first. date: 2020-08-29 11:11 starred: False tags: tagone, ipsum, tagtwo + ... Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque @@ -458,11 +460,13 @@ Feature: Custom formats """ And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in the cache should be """ + --- title: The third entry finally after weeks without writing. date: 2020-09-24 09:14 starred: False tags: tagone, tagthree - + ... + I'm so excited about emojis. 💯 🎶 💩 Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis. diff --git a/jrnl/plugins/yaml_exporter.py b/jrnl/plugins/yaml_exporter.py index df3b0548..7f9ed53a 100644 --- a/jrnl/plugins/yaml_exporter.py +++ b/jrnl/plugins/yaml_exporter.py @@ -113,14 +113,15 @@ class YAMLExporter(TextExporter): # source directory is entry.journal.config['journal'] # output directory is...? - return "title: {title}\ndate: {date}\nstarred: {starred}\ntags: {tags}\n{dayone} {body} {space}".format( + return "{start}\ntitle: {title}\ndate: {date}\nstarred: {starred}\ntags: {tags}\n{dayone}{end}\n{body}".format( + start="---", date=date_str, title=entry.title, starred=entry.starred, tags=", ".join([tag[1:] for tag in entry.tags]), dayone=dayone_attributes, body=newbody, - space="", + end="...", ) @classmethod