mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Converts \n to new lines
This commit is contained in:
parent
7e59e8ad3b
commit
fb3d7abc2d
1 changed files with 3 additions and 2 deletions
|
@ -237,15 +237,16 @@ class Journal:
|
||||||
"""Constructs a new entry from some raw text input.
|
"""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."""
|
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
|
# Split raw text into title and body
|
||||||
title_end = len(raw)
|
title_end = len(raw)
|
||||||
for separator in ".?!":
|
for separator in ".?!\n":
|
||||||
sep_pos = raw.find(separator)
|
sep_pos = raw.find(separator)
|
||||||
if 1 < sep_pos < title_end:
|
if 1 < sep_pos < title_end:
|
||||||
title_end = sep_pos
|
title_end = sep_pos
|
||||||
title = raw[:title_end+1]
|
title = raw[:title_end+1]
|
||||||
body = raw[title_end+1:].strip()
|
body = raw[title_end+1:].strip()
|
||||||
|
|
||||||
if not date:
|
if not date:
|
||||||
if title.find(":") > 0:
|
if title.find(":") > 0:
|
||||||
date = self.parse_date(title[:title.find(":")])
|
date = self.parse_date(title[:title.find(":")])
|
||||||
|
|
Loading…
Add table
Reference in a new issue