Allow editing of DayOne entries (#1001)

* add test to repro issue #955

* Allow editing of DayOne entries

* Add broken test for Dayone

Add test for editing Dayone entries (this test currently fails)

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>

* Fix editing logic for DayOneJournal

DayOneJournal previously reimplemented Journal._parse inside of
DayOneJournal.parse_editable_string, and in doing so caused issues
between itself and the class it was inheriting from. This commit fixes
the issue by moving the UUID to be in the body of the entry, rather than
above it. So, then Journal._parse still finds the correct boundaries
between entries, and DayOneJournal then parses the UUID afterward.

Co-authored-by: MinchinWeb <w_minchin@hotmail.com>
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2020-07-18 12:54:52 -07:00 committed by GitHub
parent 4c2f2861db
commit a11aa24c7e
5 changed files with 85 additions and 82 deletions

View file

@ -13,7 +13,9 @@ class Entry:
self.journal = journal # Reference to journal mainly to access its config
self.date = date or datetime.now()
self.text = text
self._title = self._body = self._tags = None
self._title = None
self._body = None
self._tags = None
self.starred = starred
self.modified = False
@ -37,18 +39,30 @@ class Entry:
self._parse_text()
return self._title
@title.setter
def title(self, x):
self._title = x
@property
def body(self):
if self._body is None:
self._parse_text()
return self._body
@body.setter
def body(self, x):
self._body = x
@property
def tags(self):
if self._tags is None:
self._parse_text()
return self._tags
@tags.setter
def tags(self, x):
self._tags = x
@staticmethod
def tag_regex(tagsymbols):
pattern = fr"(?<!\S)([{tagsymbols}][-+*#/\w]+)"