Commit 6991d34c authored by Bram Schoenmakers's avatar Bram Schoenmakers

Ignore non-word characters at end of project and context names.

parent 2d1e9e4b
......@@ -79,11 +79,11 @@ def parse_line(p_string):
rest = normal_head.group('rest')
for word in rest.split():
project = re.match(r'\+(\S+)', word)
project = re.match(r'\+(\S*\w)', word)
if project:
result['projects'].append(project.group(1))
context = re.match(r'@(\S+)', word)
context = re.match(r'@(\S*\w+)', word)
if context:
result['contexts'].append(context.group(1))
......
......@@ -156,7 +156,7 @@ class TodoBaseTester(unittest.TestCase):
self.assertEquals(todo.src, "x 2014-06-13 Foo")
def test_project1(self):
todo = TodoBase.TodoBase("(C) Foo +Bar +Baz")
todo = TodoBase.TodoBase("(C) Foo +Bar +Baz +Bar:")
self.assertEquals(len(todo.projects()), 2)
self.assertIn('Bar', todo.projects())
......@@ -169,7 +169,7 @@ class TodoBaseTester(unittest.TestCase):
self.assertIn('Bar+Baz', todo.projects())
def test_context1(self):
todo = TodoBase.TodoBase("(C) Foo @Bar @Baz")
todo = TodoBase.TodoBase("(C) Foo @Bar @Baz @Bar:")
self.assertEquals(len(todo.contexts()), 2)
self.assertIn('Bar', todo.contexts())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment