Merge pull request #252 from mjhoffman65/issue237

There should be a whitespace character in front of a tag.  Fixes issue #...
This commit is contained in:
Manuel Ebert 2014-07-27 12:32:30 +09:00
commit 010e1f868d
4 changed files with 27 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,3 @@
2014-07-22 11:11 This entry has an email.
@Newline tag should show as a tag.
Kyla's @email is kyla@clevelandunderdog.org and Guinness's is guinness@fortheloveofpits.org.

View file

@ -31,3 +31,12 @@ 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
"""
@newline : 1
@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)