From 849dc895572162de3b5ec457cde359cd05717f0b Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Mon, 28 Dec 2015 13:06:26 -0800 Subject: [PATCH] --export text doesn't indent Fixes #373 --- jrnl/Journal.py | 4 ++++ jrnl/plugins/text_exporter.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 9b568ee4..cbbcbf54 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -36,6 +36,10 @@ class Journal(object): """Returns the number of entries""" return len(self.entries) + def __iter__(self): + """Iterates over the journal's entries.""" + return (entry for entry in self.entries) + @classmethod def from_journal(cls, other): """Creates a new journal by copying configuration and entries from diff --git a/jrnl/plugins/text_exporter.py b/jrnl/plugins/text_exporter.py index 6e550956..6a904436 100644 --- a/jrnl/plugins/text_exporter.py +++ b/jrnl/plugins/text_exporter.py @@ -17,12 +17,12 @@ class TextExporter(BaseExporter): @classmethod def export_entry(cls, entry): """Returns a unicode representation of a single entry.""" - return u.__unicode__() + return entry.__unicode__() @classmethod def export_journal(cls, journal): """Returns a unicode representation of an entire journal.""" - return journal.pprint() + return "\n".join(cls.export_entry(entry) for entry in journal) @classmethod def write_file(cls, journal, path):