There should be a whitespace character in front of a tag. Fixes issue #237.

This commit is contained in:
Matt Hoffman 2014-07-22 22:14:26 -04:00
parent f8a337f66e
commit d5142a0a0a
4 changed files with 25 additions and 1 deletions

View file

@ -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": "@"
}

View file

@ -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.

View file

@ -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
"""

2
jrnl/Entry.py Normal file → Executable file
View file

@ -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)