diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index 34979619..862c8aec 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -50,8 +50,7 @@ class DayOne(Journal.Journal): date = date + timezone.utcoffset(date, is_dst=False) entry = Entry.Entry(self, date, text=dict_entry['Entry Text'], starred=dict_entry["Starred"]) entry.uuid = dict_entry["UUID"] - entry._tags = [self.config['tagsymbols'][0] + tag.lower() for tag in dict_entry.get("Tags", [])] - + entry._tags = [self.config['tagsymbols'][0] + tag.lower().replace(" ", "_") for tag in dict_entry.get("Tags", [])] self.entries.append(entry) self.sort() return self @@ -66,7 +65,7 @@ class DayOne(Journal.Journal): entry.uuid = uuid.uuid1().hex filename = os.path.join(self.config['journal'], "entries", entry.uuid.upper() + ".doentry") - + entry_plist = { 'Creation Date': utc_time, 'Starred': entry.starred if hasattr(entry, 'starred') else False, @@ -126,11 +125,14 @@ class DayOne(Journal.Journal): # Now, update our current entries if they changed for entry in entries: + # tags in entry body entry._parse_text() - matched_entries = [e for e in self.entries if e.uuid.lower() == entry.uuid] + matched_entries = [e for e in self.entries if e.uuid.lower() == entry.uuid.lower()] if matched_entries: # This entry is an existing entry match = matched_entries[0] + # merge existing tags with tags pulled from the entry body + entry.tags = list(set(entry.tags + match.tags)) if match != entry: self.entries.remove(match) entry.modified = True