mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Merge pull request #267 from maebert/issue-265
Tags at the beginning of entries
This commit is contained in:
commit
7617f9e7f8
4 changed files with 22 additions and 11 deletions
|
@ -4,6 +4,7 @@ Changelog
|
||||||
|
|
||||||
### 1.9 (July 21, 2014)
|
### 1.9 (July 21, 2014)
|
||||||
|
|
||||||
|
* __1.9.3__ Fixed: Tags at the beginning of lines
|
||||||
* __1.9.2__ Fixed: Tag search ignores email-addresses (thanks to @mjhoffman65)
|
* __1.9.2__ Fixed: Tag search ignores email-addresses (thanks to @mjhoffman65)
|
||||||
* __1.9.1__ Fixed: Dates in the future can be parsed as well.
|
* __1.9.1__ Fixed: Dates in the future can be parsed as well.
|
||||||
* __1.9.0__ Improved: Greatly improved date parsing. Also added an `-on` option for filtering
|
* __1.9.0__ Improved: Greatly improved date parsing. Also added an `-on` option for filtering
|
||||||
|
|
|
@ -31,12 +31,22 @@ Feature: Tagging
|
||||||
@c++ : 1
|
@c++ : 1
|
||||||
@c# : 1
|
@c# : 1
|
||||||
"""
|
"""
|
||||||
Scenario: An email should not be a tag
|
Scenario: An email should not be a tag
|
||||||
Given we use the config "tags-237.json"
|
Given we use the config "tags-237.json"
|
||||||
When we run "jrnl --tags"
|
When we run "jrnl --tags"
|
||||||
Then we should get no error
|
Then we should get no error
|
||||||
and the output should be
|
and the output should be
|
||||||
"""
|
"""
|
||||||
@newline : 1
|
@newline : 1
|
||||||
@email : 1
|
@email : 1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Scenario: Entry cans start and end with tags
|
||||||
|
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
|
||||||
|
"""
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Entry:
|
||||||
self.modified = False
|
self.modified = False
|
||||||
|
|
||||||
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)\s([{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)
|
||||||
|
|
|
@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line.
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
__title__ = 'jrnl'
|
__title__ = 'jrnl'
|
||||||
__version__ = '1.9.2'
|
__version__ = '1.9.3'
|
||||||
__author__ = 'Manuel Ebert'
|
__author__ = 'Manuel Ebert'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
__copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'
|
__copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'
|
||||||
|
|
Loading…
Add table
Reference in a new issue