From 5f4bcbf0986196ac321812c2822e941ac0109567 Mon Sep 17 00:00:00 2001 From: Thibaud Chupin Date: Sat, 23 Mar 2024 21:11:29 +0100 Subject: [PATCH] Correctly extract titles with multiple line breaks Since the location of the separator was computed on the `text.lstrip()` but the function returned the substring of `text` the title would be cut off. --- jrnl/journals/Entry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jrnl/journals/Entry.py b/jrnl/journals/Entry.py index 6c45303eb..7dbbbde5f 100644 --- a/jrnl/journals/Entry.py +++ b/jrnl/journals/Entry.py @@ -223,7 +223,8 @@ def __ne__(self, other: "Entry"): def split_title(text: str) -> tuple[str, str]: """Splits the first sentence off from a text.""" - sep = SENTENCE_SPLITTER_ONLY_NEWLINE.search(text.lstrip()) + text = text.lstrip() + sep = SENTENCE_SPLITTER_ONLY_NEWLINE.search(text) if not sep: sep = SENTENCE_SPLITTER.search(text) if not sep: