Compare commits

...

2 commits

Author SHA1 Message Date
Thibaud Chupin
c633f4380e
Merge 070350febb into 8be5b722aa 2025-03-02 20:41:31 +01:00
Thibaud Chupin
070350febb 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.
2024-05-25 19:24:06 +02:00

View file

@ -223,7 +223,8 @@ SENTENCE_SPLITTER_ONLY_NEWLINE = re.compile("\n")
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: