Fix YAML export syntax

This commit is contained in:
Seopril 2021-01-05 13:05:32 -05:00
parent c155bafa84
commit 78b3561127
2 changed files with 8 additions and 3 deletions

View file

@ -410,10 +410,12 @@ Feature: Custom formats
""" """
And the content of file "2020-08-29_entry-the-first.md" in the cache should be And the content of file "2020-08-29_entry-the-first.md" in the cache should be
""" """
---
title: Entry the first. title: Entry the first.
date: 2020-08-29 11:11 date: 2020-08-29 11:11
starred: False starred: False
tags: tagone, ipsum, tagtwo tags: tagone, ipsum, tagtwo
...
Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque
@ -458,10 +460,12 @@ 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 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. title: The third entry finally after weeks without writing.
date: 2020-09-24 09:14 date: 2020-09-24 09:14
starred: False starred: False
tags: tagone, tagthree tags: tagone, tagthree
...
I'm so excited about emojis. 💯 🎶 💩 I'm so excited about emojis. 💯 🎶 💩

View file

@ -113,14 +113,15 @@ class YAMLExporter(TextExporter):
# source directory is entry.journal.config['journal'] # source directory is entry.journal.config['journal']
# output directory is...? # 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, date=date_str,
title=entry.title, title=entry.title,
starred=entry.starred, starred=entry.starred,
tags=", ".join([tag[1:] for tag in entry.tags]), tags=", ".join([tag[1:] for tag in entry.tags]),
dayone=dayone_attributes, dayone=dayone_attributes,
body=newbody, body=newbody,
space="", end="...",
) )
@classmethod @classmethod