From cd6e532568aaf5f925e8e1f7b7d1ab8df979ea75 Mon Sep 17 00:00:00 2001 From: Eshan Ramesh Date: Tue, 19 May 2020 16:03:38 -0400 Subject: [PATCH] fix title splitter --- jrnl/util.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/jrnl/util.py b/jrnl/util.py index f75d9fb1..2a685be4 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -26,17 +26,7 @@ RESET_COLOR = colorama.Fore.RESET # Based on Segtok by Florian Leitner # https://github.com/fnl/segtok -SENTENCE_SPLITTER = re.compile( - r""" -( # A sentence ends at one of two sequences: - [\'\u2019\"\u201D]? # an optional right quote, - [\]\)]* # optional closing brackets and - \s+ # a sequence of required spaces. -| # Otherwise, - \n # a sentence also terminates newlines. -)""", - re.VERBOSE, -) +SENTENCE_SPLITTER = re.compile("\n") class UserAbort(Exception): @@ -262,7 +252,7 @@ def slugify(string): def split_title(text): """Splits the first sentence off from a text.""" - punkt = SENTENCE_SPLITTER.search(text) + punkt = SENTENCE_SPLITTER.search(text.strip()) if not punkt: - return text, "" + return text,"" return text[: punkt.end()].strip(), text[punkt.end() :].strip()