Simplified YAML export

This commit is contained in:
MinchinWeb 2014-12-13 21:40:52 -07:00
parent 1e582fb75b
commit 658dfb5a5f
2 changed files with 9 additions and 3 deletions

6
.gitignore vendored
View file

@ -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/

View file

@ -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