-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Feature - add bracketed date support when composing new entry (#1915) #1918
base: develop
Are you sure you want to change the base?
Feature - add bracketed date support when composing new entry (#1915) #1918
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.
raw = raw[colon_pos + 1 :].strip() | ||
raw = raw[(colon_pos + 1):].strip() | ||
else: | ||
date_blob_re = re.compile("(?:^|\n)\\[([^\\]]+)\\] ") |
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.
note: code is based on Journal._parse
with slight adaptions. E.g. the default_hour
and default_minute
handling is added.
@@ -51,6 +51,13 @@ Feature: Reading and writing to journal with custom date formats | |||
| 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? |
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.
question: is this behavior fine?
@@ -78,6 +85,14 @@ Feature: Reading and writing to journal with custom date formats | |||
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 |
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.
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 |
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.
question: I assume the dayone Journal should also be supported without issues? Will have to check that
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.