mjdescy / TodoTxtMac

TodoTxtMac is a minimalist, keyboard-driven to-do manager for Mac OS X (10.8 Mountain Lion and higher) that conforms to the todo.txt format spec.
Other
240 stars 40 forks source link

In many places TodoTxtMac allows \s where the spec requires a space #65

Closed gagern closed 9 years ago

gagern commented 9 years ago

Your parsing of the file format doesn't follow the todo.txt specs:

  1. You don't recognize a completed task as ocmplete if it doesn't have a done date. The CompletedPattern should make the date (and one space) optional.
  2. In many places you allow \s where the spec requires a space. This might break interoperability.
mjdescy commented 9 years ago

Hi, @gagern. Thanks for your feedback. I tried to follow the todo.txt format to the letter, though we all make mistakes. I'll respond to each of your points in turn.

1. TodoTxtMac doesn't recognize a completed task without a due date.

This is due to my interpretation of the todo.txt spec that you linked to. I interpret the "Complete Tasks: 2 Format Rules" section of the format spec to mean that both Rule 1 (lowercase x) and Rule 2 (completion date) must be met for a task to be considered complete. There is language in those sections that supports this interpretation:

  1. "Two things indicate that a task has been completed." It's "two things", not one of two things. I interpret that as two things AND-ed together, as in both the leading "x" and space, and the completion date.
  2. "With the completed date (required), if you’ve used the prepended date (optional), you can calculate how many days it took to complete a task." Note the parenthetical "required" as it applies to completion date.

Upon a really close reading, it looks like the spec can be interpreted differently. That, and the spec has changed over time, including several times since I first coded TodoTxtMac. It's a moving target. I am pretty comfortable with my interpretation of the spec as it stands at this time, however.

2. In many places you allow \s where the spec requires a space. This might break interoperability.

It sounds like you're suggesting that \s is too lenient and will match non-space whitespace characters. You are correct, and that might warrant a change. I don't think interoperability will be affected too much either way. At least within TodoTxtMac, it would be atypical for users to be able to enter line breaks or tabs (or other whitespace characters) into the task (the editor makes that sort of thing hard to do). I may experiment with replacing \s in the regular expressions with a " " or "[ ]".

gagern commented 9 years ago

I agree now that the completion date is likely a strict requirement. Sorry, been to hasty in my first read.

mjdescy commented 9 years ago

No problem. I will consider your second item for a future improvement. I don't think there is much of a risk of interoperability problems, so I'm not going to make a change right away.