-
-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix title splitting logic to account for both newlines and periods #958
Conversation
I lost track of the correct order of |
I think this is a good compromise for the title splitting. Thank you! Can you please add some tests for the changed functionality? |
I added one test for multi-line entries with punctuation and one test for single-line entries with punctuation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
) * remove period parsing in title * fix title splitter * revert title-body switch * keep both splitting types * make black happy * make it lstrip not strip * fix title-body order for the last time * make black happy again * added test * second test for single line entry with punctuation * delete extra blank lines
This PR changes the logic for separating the title from the rest of the entry. This is intended to fix #945.
It's important to note that we can't just remove all sentence terminal checking, because then normal command-entry breaks. When a user enters an entry at the command line, they obviously can't naturally newline, so we still have to break the sentence by terminals. However, if there is a newline, then we can infer that that was where the user truly wanted the title to end because they were writing in a full text editor.
Because of this, it is impossible to fully fix #945, but it is possible to fix it if there is a newline character following the sentence.
Here are some cases:
User:
jrnl I did it! I won the competition. I am so happy
Result:
This is no different from earlier
However, if the user in a text editor writes:
I did it! I won the competition.
I am so happy
The result is now
This is different
This fixes #945 without messing up anything else.
Checklist
poetry run behave
black (consistent code styling). --
poetry run black --check . --verbose --diff
(logically errors and unused imports). --
poetry run pyflakes jrnl features
Pull Requests for the same update/change?
us to include them?