Tags at the beginning of lines

This commit is contained in:
Manuel Ebert 2014-08-07 13:25:50 +02:00
parent 6dafc3d939
commit db3de3d1cc
2 changed files with 21 additions and 10 deletions

View file

@ -40,3 +40,14 @@ Feature: Tagging
@newline : 1
@email : 1
"""
Scenario: Entry cans start and end with tags
Scenario: Writing an entry from command line
Given we use the config "basic.json"
When we run "jrnl today: @foo came over, we went to a @bar"
When we run "jrnl --tags"
Then the output should be
"""
@foo : 1
@bar : 1
"""

View file

@ -17,7 +17,7 @@ class Entry:
self.modified = False
def parse_tags(self):
fulltext = " ".join([self.title, self.body]).lower()
fulltext = " " + " ".join([self.title, self.body]).lower()
tags = re.findall(r'(?u)\s([{tags}][-+*#/\w]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE)
self.tags = tags
return set(tags)