mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +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)
|
||||
obj
|
||||
*.pyproj
|
||||
*.pyproj.user
|
||||
*.sln
|
||||
*.suo
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-*
|
||||
|
||||
# virtaulenv
|
||||
env/
|
||||
env*/
|
||||
|
@ -50,3 +54,5 @@ docs/_themes/jrnl/static/less/3L.less
|
|||
|
||||
# export testing director
|
||||
exp/
|
||||
|
||||
extras/
|
||||
|
|
|
@ -65,16 +65,16 @@ def to_txt(journal):
|
|||
"""Returns the complete text of the Journal."""
|
||||
return journal.pprint()
|
||||
|
||||
|
||||
def to_yaml(entry):
|
||||
"""Returns a markdown representation of the Journal with YAML formatted
|
||||
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))
|
||||
if entry.tags:
|
||||
# drop tag symbol
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue