mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 03:58:32 +02:00
Simplified YAML export
This commit is contained in:
parent
1e582fb75b
commit
658dfb5a5f
2 changed files with 9 additions and 3 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -36,9 +36,13 @@ docs/_themes/jrnl/static/css/jrnl.css
|
||||||
# MS Visual Studio (PyTools)
|
# MS Visual Studio (PyTools)
|
||||||
obj
|
obj
|
||||||
*.pyproj
|
*.pyproj
|
||||||
|
*.pyproj.user
|
||||||
*.sln
|
*.sln
|
||||||
*.suo
|
*.suo
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.sublime-*
|
||||||
|
|
||||||
# virtaulenv
|
# virtaulenv
|
||||||
env/
|
env/
|
||||||
env*/
|
env*/
|
||||||
|
@ -50,3 +54,5 @@ docs/_themes/jrnl/static/less/3L.less
|
||||||
|
|
||||||
# export testing director
|
# export testing director
|
||||||
exp/
|
exp/
|
||||||
|
|
||||||
|
extras/
|
||||||
|
|
|
@ -65,16 +65,16 @@ def to_txt(journal):
|
||||||
"""Returns the complete text of the Journal."""
|
"""Returns the complete text of the Journal."""
|
||||||
return journal.pprint()
|
return journal.pprint()
|
||||||
|
|
||||||
|
|
||||||
def to_yaml(entry):
|
def to_yaml(entry):
|
||||||
"""Returns a markdown representation of the Journal with YAML formatted
|
"""Returns a markdown representation of the Journal with YAML formatted
|
||||||
front matter"""
|
front matter"""
|
||||||
out = u''
|
out = u'Title: {}\n'.format(entry.title)
|
||||||
out += u'Title: {}\n'.format(entry.title)
|
|
||||||
out += u'Date: {}\n'.format(str(entry.date))
|
out += u'Date: {}\n'.format(str(entry.date))
|
||||||
if entry.tags:
|
if entry.tags:
|
||||||
# drop tag symbol
|
# drop tag symbol
|
||||||
out += u'Tags: {}\n'.format(', '.join([tag[1:] for tag in entry.tags]))
|
out += u'Tags: {}\n'.format(', '.join([tag[1:] for tag in entry.tags]))
|
||||||
out += u'---\n\n{}'.format(entry.body)
|
out += u'{}'.format(entry.body)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue