mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Fix YAML body block indentation
This commit is contained in:
parent
730bf5303f
commit
42672f76d0
2 changed files with 37 additions and 32 deletions
|
@ -415,8 +415,7 @@ Feature: Custom formats
|
|||
date: 2020-08-29 11:11
|
||||
starred: False
|
||||
tags: tagone, ipsum, tagtwo
|
||||
...
|
||||
|
||||
body: |
|
||||
Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque
|
||||
augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
|
||||
|
@ -435,6 +434,7 @@ Feature: Custom formats
|
|||
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
conubia nostra, per inceptos himenaeos.
|
||||
...
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
|
@ -465,8 +465,7 @@ Feature: Custom formats
|
|||
date: 2020-09-24 09:14
|
||||
starred: False
|
||||
tags: tagone, tagthree
|
||||
...
|
||||
|
||||
body: |
|
||||
I'm so excited about emojis. 💯 🎶 💩
|
||||
|
||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
||||
|
@ -477,6 +476,7 @@ Feature: Custom formats
|
|||
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
...
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
|
|
|
@ -75,6 +75,11 @@ class YAMLExporter(TextExporter):
|
|||
if previous_line not in ["\r", "\n", "\r\n", "\n\r"]:
|
||||
newbody = newbody + os.linesep
|
||||
|
||||
# set indentation for YAML body block
|
||||
spacebody = "\t"
|
||||
for line in newbody.splitlines(True):
|
||||
spacebody = spacebody + "\t" + line
|
||||
|
||||
if warn_on_heading_level is True:
|
||||
print(
|
||||
"{}WARNING{}: Headings increased past H6 on export - {} {}".format(
|
||||
|
@ -113,14 +118,14 @@ class YAMLExporter(TextExporter):
|
|||
# source directory is entry.journal.config['journal']
|
||||
# output directory is...?
|
||||
|
||||
return "{start}\ntitle: {title}\ndate: {date}\nstarred: {starred}\ntags: {tags}\n{dayone}{end}\n{body}".format(
|
||||
return "{start}\ntitle: {title}\ndate: {date}\nstarred: {starred}\ntags: {tags}\n{dayone}body: |{body}{end}".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,
|
||||
body=spacebody,
|
||||
end="...",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue