mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
don't ignore the blank lines #15
This commit is contained in:
parent
448f56473d
commit
7c3a6d0222
1 changed files with 13 additions and 12 deletions
9
jrnl.py
9
jrnl.py
|
@ -173,18 +173,19 @@ class Journal:
|
|||
current_entry = None
|
||||
|
||||
for line in journal.split(os.linesep):
|
||||
if line:
|
||||
try:
|
||||
# try to parse line as date => new entry begins
|
||||
new_date = datetime.strptime(line[:date_length], self.config['timeformat'])
|
||||
# make a journal entry of the current stuff first
|
||||
|
||||
# parsing successfull => save old entry and create new one
|
||||
if new_date and current_entry:
|
||||
entries.append(current_entry)
|
||||
# Start constructing current entry
|
||||
current_entry = Entry(self, date=new_date, title=line[date_length+1:])
|
||||
except ValueError:
|
||||
# Happens when we can't parse the start of the line as an date.
|
||||
# In this case, just append line to our body.
|
||||
current_entry.body += line
|
||||
current_entry.body += line + os.linesep
|
||||
|
||||
# Append last entry
|
||||
if current_entry:
|
||||
entries.append(current_entry)
|
||||
|
|
Loading…
Add table
Reference in a new issue