How to use the jrnl.Entry.Entry.tag_regex function in jrnl

To help you get started, we’ve selected a few jrnl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jrnl-org / jrnl / jrnl / Entry.py View on Github external
def _parse_tags(self):
        tagsymbols = self.journal.config["tagsymbols"]
        return {
            tag.lower() for tag in re.findall(Entry.tag_regex(tagsymbols), self.text)
        }
github jrnl-org / jrnl / jrnl / Journal.py View on Github external
def pprint(self, short=False):
        """Prettyprints the journal's entries"""
        sep = "\n"
        pp = sep.join([e.pprint(short=short) for e in self.entries])
        if self.config['highlight']:  # highlight tags
            if self.search_tags:
                for tag in self.search_tags:
                    tagre = re.compile(re.escape(tag), re.IGNORECASE)
                    pp = re.sub(tagre,
                                lambda match: util.colorize(match.group(0)),
                                pp)
            else:
                pp = re.sub(
                    Entry.Entry.tag_regex(self.config['tagsymbols']),
                    lambda match: util.colorize(match.group(0)),
                    pp
                )
        return pp