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) # 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/

View file

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