mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +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
|
date: 2020-08-29 11:11
|
||||||
starred: False
|
starred: False
|
||||||
tags: tagone, ipsum, tagtwo
|
tags: tagone, ipsum, tagtwo
|
||||||
...
|
body: |
|
||||||
|
|
||||||
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
|
||||||
augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
|
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
|
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||||
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||||
conubia nostra, per inceptos himenaeos.
|
conubia nostra, per inceptos himenaeos.
|
||||||
|
...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Examples: configs
|
Examples: configs
|
||||||
|
@ -465,8 +465,7 @@ Feature: Custom formats
|
||||||
date: 2020-09-24 09:14
|
date: 2020-09-24 09:14
|
||||||
starred: False
|
starred: False
|
||||||
tags: tagone, tagthree
|
tags: tagone, tagthree
|
||||||
...
|
body: |
|
||||||
|
|
||||||
I'm so excited about emojis. 💯 🎶 💩
|
I'm so excited about emojis. 💯 🎶 💩
|
||||||
|
|
||||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
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.
|
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||||
ante eget fringilla. @tagthree and also @tagone
|
ante eget fringilla. @tagthree and also @tagone
|
||||||
|
...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Examples: configs
|
Examples: configs
|
||||||
|
|
|
@ -75,6 +75,11 @@ class YAMLExporter(TextExporter):
|
||||||
if previous_line not in ["\r", "\n", "\r\n", "\n\r"]:
|
if previous_line not in ["\r", "\n", "\r\n", "\n\r"]:
|
||||||
newbody = newbody + os.linesep
|
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:
|
if warn_on_heading_level is True:
|
||||||
print(
|
print(
|
||||||
"{}WARNING{}: Headings increased past H6 on export - {} {}".format(
|
"{}WARNING{}: Headings increased past H6 on export - {} {}".format(
|
||||||
|
@ -113,14 +118,14 @@ class YAMLExporter(TextExporter):
|
||||||
# source directory is entry.journal.config['journal']
|
# source directory is entry.journal.config['journal']
|
||||||
# output directory is...?
|
# 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="---",
|
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=spacebody,
|
||||||
end="...",
|
end="...",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue