mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Better Python2.6 compatibility
This commit is contained in:
parent
13f8e668dc
commit
29005c0e07
3 changed files with 4 additions and 4 deletions
|
@ -46,7 +46,6 @@ def check_output(context):
|
||||||
@then('the output should contain "{text}"')
|
@then('the output should contain "{text}"')
|
||||||
def check_output_inline(context, text):
|
def check_output_inline(context, text):
|
||||||
out = context.stdout_capture.getvalue()
|
out = context.stdout_capture.getvalue()
|
||||||
print out
|
|
||||||
assert text in out
|
assert text in out
|
||||||
|
|
||||||
@then('the journal should contain "{text}"')
|
@then('the journal should contain "{text}"')
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Entry:
|
||||||
|
|
||||||
def parse_tags(self):
|
def parse_tags(self):
|
||||||
fulltext = " ".join([self.title, self.body]).lower()
|
fulltext = " ".join([self.title, self.body]).lower()
|
||||||
tags = re.findall(r'(?u)([{}]\w+)'.format(self.journal.config['tagsymbols']), fulltext, re.UNICODE)
|
tags = re.findall(r'(?u)([{tags}]\w+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE)
|
||||||
return set(tags)
|
return set(tags)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
|
|
@ -152,6 +152,7 @@ class Journal(object):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Happens when we can't parse the start of the line as an date.
|
# Happens when we can't parse the start of the line as an date.
|
||||||
# In this case, just append line to our body.
|
# In this case, just append line to our body.
|
||||||
|
if current_entry:
|
||||||
current_entry.body += line + "\n"
|
current_entry.body += line + "\n"
|
||||||
|
|
||||||
# Append last entry
|
# Append last entry
|
||||||
|
@ -173,7 +174,7 @@ class Journal(object):
|
||||||
lambda match: self._colorize(match.group(0)),
|
lambda match: self._colorize(match.group(0)),
|
||||||
pp, re.UNICODE)
|
pp, re.UNICODE)
|
||||||
else:
|
else:
|
||||||
pp = re.sub(r"(?u)([{}]\w+)".format(self.config['tagsymbols']),
|
pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']),
|
||||||
lambda match: self._colorize(match.group(0)),
|
lambda match: self._colorize(match.group(0)),
|
||||||
pp)
|
pp)
|
||||||
return pp
|
return pp
|
||||||
|
|
Loading…
Add table
Reference in a new issue