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
8a28afc7bd
commit
11a73b4fc2
1 changed files with 5 additions and 2 deletions
|
@ -137,9 +137,12 @@ class Journal:
|
|||
sep = "-"*60+"\n"
|
||||
pp = sep.join([str(e) for e in self.entries])
|
||||
if self.config['highlight']: # highlight tags
|
||||
if hasattr(self, 'search_tags'):
|
||||
if 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:
|
||||
pp = re.sub(r"([%s]\w+)" % self.config['tagsymbols'],
|
||||
lambda match: self._colorize(match.group(0), 'cyan'),
|
||||
|
|
Loading…
Add table
Reference in a new issue