mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Starring entries and looking at the stars
This commit is contained in:
parent
33e14d806d
commit
588229581b
1 changed files with 2 additions and 4 deletions
|
@ -28,7 +28,6 @@ except ImportError:
|
||||||
import plistlib
|
import plistlib
|
||||||
import pytz
|
import pytz
|
||||||
import uuid
|
import uuid
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
class Journal(object):
|
class Journal(object):
|
||||||
def __init__(self, name='default', **kwargs):
|
def __init__(self, name='default', **kwargs):
|
||||||
|
@ -99,7 +98,6 @@ class Journal(object):
|
||||||
Entries have the form (date, title, body)."""
|
Entries have the form (date, title, body)."""
|
||||||
filename = filename or self.config['journal']
|
filename = filename or self.config['journal']
|
||||||
|
|
||||||
|
|
||||||
if self.config['encrypt']:
|
if self.config['encrypt']:
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
journal_encrypted = f.read()
|
journal_encrypted = f.read()
|
||||||
|
@ -254,7 +252,7 @@ class Journal(object):
|
||||||
date, flag = self.dateparse.parse(date_str)
|
date, flag = self.dateparse.parse(date_str)
|
||||||
|
|
||||||
if not flag: # Oops, unparsable.
|
if not flag: # Oops, unparsable.
|
||||||
try: # Try and parse this as a single year
|
try: # Try and parse this as a single year
|
||||||
year = int(date_str)
|
year = int(date_str)
|
||||||
return datetime(year, 1, 1)
|
return datetime(year, 1, 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -293,7 +291,7 @@ class Journal(object):
|
||||||
starred = False
|
starred = False
|
||||||
if not date:
|
if not date:
|
||||||
if title.find(":") > 0:
|
if title.find(":") > 0:
|
||||||
starred = "*" in title[:title.find(":")]
|
starred = "*" in title[:title.find(":")]
|
||||||
date = self.parse_date(title[:title.find(":")])
|
date = self.parse_date(title[:title.find(":")])
|
||||||
if date or starred: # Parsed successfully, strip that from the raw text
|
if date or starred: # Parsed successfully, strip that from the raw text
|
||||||
title = title[title.find(":")+1:].strip()
|
title = title[title.find(":")+1:].strip()
|
||||||
|
|
Loading…
Add table
Reference in a new issue