Skip to content

Commit

Permalink
Correctly extract titles with multiple line breaks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
comkieffer committed Mar 23, 2024
1 parent 2af05e4 commit 5f4bcbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jrnl/journals/Entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5f4bcbf

Please sign in to comment.