From d5142a0a0ae8f8b6273ad48ea0b0aec16d09b3a1 Mon Sep 17 00:00:00 2001 From: Matt Hoffman Date: Tue, 22 Jul 2014 22:14:26 -0400 Subject: [PATCH] There should be a whitespace character in front of a tag. Fixes issue #237. --- features/data/configs/tags-237.json | 14 ++++++++++++++ features/data/journals/tags-237.journal | 2 ++ features/tagging.feature | 8 ++++++++ jrnl/Entry.py | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 features/data/configs/tags-237.json create mode 100644 features/data/journals/tags-237.journal mode change 100644 => 100755 jrnl/Entry.py diff --git a/features/data/configs/tags-237.json b/features/data/configs/tags-237.json new file mode 100644 index 00000000..55801a6d --- /dev/null +++ b/features/data/configs/tags-237.json @@ -0,0 +1,14 @@ +{ + "default_hour": 9, + "timeformat": "%Y-%m-%d %H:%M", + "linewrap": 80, + "encrypt": false, + "editor": "", + "default_minute": 0, + "highlight": true, + "password": "", + "journals": { + "default": "features/journals/tags-237.journal" + }, + "tagsymbols": "@" +} diff --git a/features/data/journals/tags-237.journal b/features/data/journals/tags-237.journal new file mode 100644 index 00000000..bb0fa976 --- /dev/null +++ b/features/data/journals/tags-237.journal @@ -0,0 +1,2 @@ +2014-07-22 11:11 This entry has an email. +Kyla's @email is kyla@clevelandunderdog.org and Guinness's is guinness@fortheloveofpits.org. diff --git a/features/tagging.feature b/features/tagging.feature index 2d317938..19bdeb54 100644 --- a/features/tagging.feature +++ b/features/tagging.feature @@ -31,3 +31,11 @@ Feature: Tagging @c++ : 1 @c# : 1 """ + Scenario: An email should not be a tag + Given we use the config "tags-237.json" + When we run "jrnl --tags" + Then we should get no error + and the output should be + """ + @email : 1 + """ \ No newline at end of file diff --git a/jrnl/Entry.py b/jrnl/Entry.py old mode 100644 new mode 100755 index 31b607c9..fb92c3b6 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -18,7 +18,7 @@ class Entry: def parse_tags(self): fulltext = " ".join([self.title, self.body]).lower() - tags = re.findall(r'(?u)([{tags}][-+*#/\w]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) + tags = re.findall(r'(?u)\s([{tags}][-+*#/\w]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) self.tags = tags return set(tags)