Feature - add bracketed date support when composing new entry (#1915)#1918
Open
chwt wants to merge 1 commit intojrnl-org:developfrom
Open
Conversation
…rg#1915) Bracketed dates like [2020-01-01] will be parsed and used as the entry date, thus be removed from the entry text.
chwt
commented
Sep 24, 2024
| raw = raw[colon_pos + 1 :].strip() | ||
| raw = raw[(colon_pos + 1):].strip() | ||
| else: | ||
| date_blob_re = re.compile("(?:^|\n)\\[([^\\]]+)\\] ") |
Author
There was a problem hiding this comment.
note: code is based on Journal._parse with slight adaptions. E.g. the default_hour and default_minute handling is added.
| | little_endian_dates.yaml | 2032-02-01: Test. | 01.02.2032 09:00 Test. | | ||
| | little_endian_dates.yaml | 2020-01-01: Test. | 01.01.2020 09:00 Test. | | ||
| | little_endian_dates.yaml | 2020-12-31: Test. | 31.12.2020 09:00 Test. | | ||
| # @todo: is it fine that default time be used here and not 00:00? |
| Then the output should contain "10.05.2013 09:00 I saw Elvis." | ||
| And the output should contain "He's alive." | ||
|
|
||
| Scenario: Writing an entry at the prompt with custom date in bracket format |
Author
There was a problem hiding this comment.
note: could be integrated into test above as config
| | config_file | command | | ||
| | simple.yaml | [2013-07-20] Best day of my life! * | | ||
| | empty_folder.yaml | [2013-07-20] Best day of my life! * | | ||
| # Note: this one fail due to whitespace, cmp. next config |
Author
There was a problem hiding this comment.
question: I assume the dayone Journal should also be supported without issues? Will have to check that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bracketed dates like
[2020-01-01]at the beginning of an entry will be parsed and used as the entry date, thus be removed from the entry text.Colon
:and starred*usage is mostly covered too, see test cases.Fixes #1915
Checklist
for the same issue.