From 8dc3df392e979142e60c60bf7caee7e434b5a3a0 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Thu, 5 Jul 2012 12:44:40 +0200 Subject: [PATCH] Converts \n to new lines --- jrnl/Journal.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 4560fc33..d88cd3f9 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -237,15 +237,16 @@ class Journal: """Constructs a new entry from some raw text input. If a date is given, it will parse and use this, otherwise scan for a date in the input first.""" + raw = raw.replace('\\n ', '\n').replace('\\n', '\n') + # Split raw text into title and body title_end = len(raw) - for separator in ".?!": + for separator in ".?!\n": sep_pos = raw.find(separator) if 1 < sep_pos < title_end: title_end = sep_pos title = raw[:title_end+1] body = raw[title_end+1:].strip() - if not date: if title.find(":") > 0: date = self.parse_date(title[:title.find(":")])