diff --git a/features/regression.feature b/features/regression.feature index 029c257c..ad52e2c4 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -30,3 +30,25 @@ Feature: Zapped bugs should stay dead. """ 2013-10-27 03:27 Some text. """ + + Scenario: Title with an embedded period. + Given we use the config "basic.json" + When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should be + """ + 2014-04-24 09:00 Created a new website - empty.com. + | Hope to get a lot of traffic. + """ + + Scenario: Title with an embedded period on DayOne journal + Given we use the config "dayone.json" + When we run "jrnl 04-24-2014: Ran 6.2 miles today in 1:02:03. I'm feeling sore because I forgot to stretch." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should be + """ + 2014-04-24 09:00 Ran 6.2 miles today in 1:02:03. + | I'm feeling sore because I forgot to stretch. + """ \ No newline at end of file diff --git a/jrnl/Journal.py b/jrnl/Journal.py index bd1eab52..74afecf7 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -290,7 +290,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|[\?!.]+ *\n?", raw) + sep = re.search("\n|[\?!.]+ +\n?", raw) title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "") starred = False if not date: @@ -354,7 +354,7 @@ class DayOne(Journal): date = dict_entry['Creation Date'] date = date + timezone.utcoffset(date, is_dst=False) raw = dict_entry['Entry Text'] - sep = re.search("[\n!?.]+", raw) + sep = re.search("\n|[\?!.]+ +\n?", raw) title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "") entry = Entry.Entry(self, date, title, body, starred=dict_entry["Starred"]) entry.uuid = dict_entry["UUID"]