mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Fixes highlighting
This commit is contained in:
parent
dd824c4f8d
commit
0d19f1790f
1 changed files with 5 additions and 2 deletions
|
@ -137,9 +137,12 @@ class Journal:
|
||||||
sep = "-"*60+"\n"
|
sep = "-"*60+"\n"
|
||||||
pp = sep.join([str(e) for e in self.entries])
|
pp = sep.join([str(e) for e in self.entries])
|
||||||
if self.config['highlight']: # highlight tags
|
if self.config['highlight']: # highlight tags
|
||||||
if hasattr(self, 'search_tags'):
|
if self.search_tags:
|
||||||
for tag in self.search_tags:
|
for tag in self.search_tags:
|
||||||
pp = pp.replace(tag, self._colorize(tag))
|
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
||||||
|
pp = re.sub(tagre,
|
||||||
|
lambda match: self._colorize(match.group(0), 'cyan'),
|
||||||
|
pp)
|
||||||
else:
|
else:
|
||||||
pp = re.sub(r"([%s]\w+)" % self.config['tagsymbols'],
|
pp = re.sub(r"([%s]\w+)" % self.config['tagsymbols'],
|
||||||
lambda match: self._colorize(match.group(0), 'cyan'),
|
lambda match: self._colorize(match.group(0), 'cyan'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue