diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d4354f..efe8ba88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ### 1.7 (December 22, 2013) +* __1.7.17__ Fixes writing new lines between entries * __1.7.16__ Even more unicode fixes! * __1.7.15__ More unicode fixes * __1.7.14__ Fix for trailing whitespaces (eg. when writing markdown code block) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 37db507c..461014fe 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -25,14 +25,13 @@ class Entry: def __unicode__(self): """Returns a string representation of the entry to be written into a journal file.""" date_str = self.date.strftime(self.journal.config['timeformat']) - title = date_str + " " + self.title + title = date_str + " " + self.title.rstrip("\n ") if self.starred: title += " *" - return u"{title}{sep}{body}\n".format( title=title, - sep="\n" if self.body else "", - body=self.body + sep="\n" if self.body.rstrip("\n ") else "", + body=self.body.rstrip("\n ") ) def pprint(self, short=False): @@ -47,11 +46,11 @@ class Entry: initial_indent="| ", subsequent_indent="| ", drop_whitespace=False) - for line in self.body.rstrip().splitlines() + for line in self.body.rstrip(" \n").splitlines() ]) else: - title = date_str + " " + self.title - body = self.body + title = date_str + " " + self.title.rstrip("\n ") + body = self.body.rstrip("\n ") # Suppress bodies that are just blanks and new lines. has_body = len(self.body) > 20 or not all(char in (" ", "\n") for char in self.body) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index d1ebc1d0..68417bea 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -280,7 +280,7 @@ class Journal(object): raw = raw.replace('\\n ', '\n').replace('\\n', '\n') starred = False # Split raw text into title and body - sep = re.search("\n|[\?.]+", raw) + sep = re.search("\n|[\?!.]+ *", raw) title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "") starred = False if not date: diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 9a84a0a5..212aae6f 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.7.16' +__version__ = '1.7.17' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'