From af222fd5260de2e43dd05be3c73b6976f0cfd852 Mon Sep 17 00:00:00 2001 From: B Krishna Chaitanya Date: Fri, 27 Jun 2014 11:58:59 +0530 Subject: [PATCH 1/5] Changed regex to accept symbols --- jrnl/Entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 461014fe..66109f32 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -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)([{tags}][^\s]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) self.tags = tags return set(tags) From ef0e192d7977c48a63e7f73d0b658f53cea2d105 Mon Sep 17 00:00:00 2001 From: B Krishna Chaitanya Date: Fri, 27 Jun 2014 21:08:10 +0530 Subject: [PATCH 2/5] Include [-+/*#] in tag characters --- jrnl/Entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 66109f32..9ff4f64a 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -18,7 +18,7 @@ class Entry: def parse_tags(self): fulltext = " ".join([self.title, self.body]).lower() - tags = re.findall(r'(?u)([{tags}][^\s]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) + tags = re.findall(r'(?u)([{tags}][\w\+/\-\*#]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) self.tags = tags return set(tags) From add0aea46d272d762a0c5b2220fc09c5e10f929b Mon Sep 17 00:00:00 2001 From: B Krishna Chaitanya Date: Mon, 30 Jun 2014 14:38:00 +0530 Subject: [PATCH 3/5] Unescaped -, + and * in regex --- jrnl/Entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 9ff4f64a..31b607c9 100644 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -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)([{tags}][-+*#/\w]+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE) self.tags = tags return set(tags) From 88d4c525689a5b1f661c4cd45aaa1bc3c1276fac Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 2 Jul 2014 15:34:08 +0200 Subject: [PATCH 4/5] Tests for tagging --- features/data/configs/tags-216.json | 14 ++++++++++++++ features/data/journals/tags-216.journal | 2 ++ features/data/journals/tags.journal | 1 + features/tagging.feature | 11 +++++++++++ 4 files changed, 28 insertions(+) create mode 100644 features/data/configs/tags-216.json create mode 100644 features/data/journals/tags-216.journal diff --git a/features/data/configs/tags-216.json b/features/data/configs/tags-216.json new file mode 100644 index 00000000..4164d6f5 --- /dev/null +++ b/features/data/configs/tags-216.json @@ -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-216.journal" + }, + "tagsymbols": "@" +} diff --git a/features/data/journals/tags-216.journal b/features/data/journals/tags-216.journal new file mode 100644 index 00000000..4bd942b9 --- /dev/null +++ b/features/data/journals/tags-216.journal @@ -0,0 +1,2 @@ +2013-06-10 15:40 I programmed for @OS/2. +Almost makes me want to go back to @C++, though. (Still better than @C#). diff --git a/features/data/journals/tags.journal b/features/data/journals/tags.journal index bfd49cf4..b4186a53 100644 --- a/features/data/journals/tags.journal +++ b/features/data/journals/tags.journal @@ -5,3 +5,4 @@ 2013-06-10 15:40 I met with @dan. As alway's he shared his latest @idea on how to rule the world with me. +inst diff --git a/features/tagging.feature b/features/tagging.feature index a30c1052..2d317938 100644 --- a/features/tagging.feature +++ b/features/tagging.feature @@ -20,3 +20,14 @@ Feature: Tagging @idea : 1 @dan : 1 """ + + Scenario: Tags should allow certain special characters + Given we use the config "tags-216.json" + When we run "jrnl --tags" + Then we should get no error + and the output should be + """ + @os/2 : 1 + @c++ : 1 + @c# : 1 + """ From d8e0bab3abe3ff6c2931ddf750a8137559b33b00 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 2 Jul 2014 15:36:04 +0200 Subject: [PATCH 5/5] Version bump --- CHANGELOG.md | 1 + jrnl/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ebae8f5..11d5e9ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ### 1.8 (May 22, 2014) +* __1.8.5__ Improved: Tags like @C++ and @OS/2 work, too (thanks to @chaitan94) * __1.8.5__ Fixed: file names when exporting to individual files contain full year (thanks to @jdevera) * __1.8.4__ Improved: using external editors (thanks to @chrissexton) * __1.8.3__ Fixed: export to text files and improves help (thanks to @igniteflow and @mpe) diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 0984ff98..5e4bb1af 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.8.5' +__version__ = '1.8.6' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'