def write_files(journal, path, format):
 make_filename = (lambda entry: e.date.strftime(u'%Y-%m-%d_{0}.{1}'.format(slugify(u(e.title)), format)))
 for e in journal.entries:
  full_path = os.path.join(path, make_filename(e))
  if (format == u'json'):
   content = (json.dumps(e.to_dict(), indent=2) + u'\n')
  elif (format in (u'md', u'markdown')):
   content = e.to_md()
  elif (format in (u'txt', u'text')):
   content = e.__unicode__()
  with codecs.open(full_path, u'w', u'utf-8') as f:
   f.write(content)
 return u'[Journal exported individual files in {0}]'.format(path)

def write_files ( journal , path , format ) : make_filename = ( lambda entry : e . date . strftime ( u'%Y-%m-%d_{0}.{1}' . format ( slugify ( u ( e . title ) ) , format ) ) ) for e in journal . entries : full_path = os . path . join ( path , make_filename ( e ) ) if ( format == u'json' ) : content = ( json . dumps ( e . to_dict ( ) , indent = 2 ) + u'\n' ) elif ( format in ( u'md' , u'markdown' ) ) : content = e . to_md ( ) elif ( format in ( u'txt' , u'text' ) ) : content = e . __unicode__ ( ) with codecs . open ( full_path , u'w' , u'utf-8' ) as f : f . write ( content ) return u'[Journal exported individual files in {0}]' . format ( path )
turns your journal into separate files for each entry .