mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
There should be a whitespace character in front of a tag. Fixes issue #237.
This commit is contained in:
parent
f8a337f66e
commit
d5142a0a0a
4 changed files with 25 additions and 1 deletions
14
features/data/configs/tags-237.json
Normal file
14
features/data/configs/tags-237.json
Normal 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": "@"
|
||||||
|
}
|
2
features/data/journals/tags-237.journal
Normal file
2
features/data/journals/tags-237.journal
Normal 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.
|
|
@ -31,3 +31,11 @@ Feature: Tagging
|
||||||
@c++ : 1
|
@c++ : 1
|
||||||
@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
2
jrnl/Entry.py
Normal file → Executable file
|
@ -18,7 +18,7 @@ class Entry:
|
||||||
|
|
||||||
def parse_tags(self):
|
def parse_tags(self):
|
||||||
fulltext = " ".join([self.title, self.body]).lower()
|
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
|
self.tags = tags
|
||||||
return set(tags)
|
return set(tags)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue