# HG changeset patch # User Steve Losh # Date 1254194382 14400 # Node ID b8afd9a5c913d59d744a11bae693eba64d9dbac1 # Parent 68288cdc5a7f19ecc3ffdfe30a8e7e1485068dda Support lines without metadata in taskfiles to ease plaintext editing. diff -r 68288cdc5a7f -r b8afd9a5c913 t.py --- a/t.py Mon Sep 28 23:14:29 2009 -0400 +++ b/t.py Mon Sep 28 23:19:42 2009 -0400 @@ -49,12 +49,19 @@ 'text': , ... other metadata ... } + A taskline can also consist of only summary text, in which case the id + and other metadata will be generated when the line is read. This is + supported to enable editing of the taskfile with a simple text editor. """ - text, _, meta = taskline.partition('|') - task = { 'text': text.strip() } - for piece in meta.strip().split(','): - label, data = piece.split(':') - task[label.strip()] = data.strip() + if '|' in taskline: + text, _, meta = taskline.partition('|') + task = { 'text': text.strip() } + for piece in meta.strip().split(','): + label, data = piece.split(':') + task[label.strip()] = data.strip() + else: + text = taskline.strip() + task = { 'id': _hash(text), 'text': text } return task def _tasklines_from_tasks(tasks):