mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Merge pull request #161 from notbalanced/master
Re-fix Issue #56 by changing Regex for title.
This commit is contained in:
commit
cd96b37ec7
2 changed files with 24 additions and 2 deletions
|
@ -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.
|
||||
"""
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Reference in a new issue