EpocDotFr / todotxtio

Simple Python module to parse, manipulate and write Todo.txt data
https://epocdotfr.github.io/todotxtio/
Other
15 stars 9 forks source link

Detection of projects and context fails if either is first word in task #12

Open Strubbl opened 6 years ago

Strubbl commented 6 years ago

Let's assume i have the following task: 2018-05-19 +read webpage http://todotxt.org/ +background

todotxtio recognizes the project background very well, but it does not recognize read as a project. This is due to the regular expression, which needs a space in front of a project/context. It seems that during parsing of tasks this is not given, if the project/context is directly at the beginning of a task or if the project/context directly followings a date.

EpocDotFr commented 6 years ago

In your example the first project is preceeded by a space, so it should work?

Strubbl commented 6 years ago

That is an example, where it fails. My guess is that the date is recognized by a regex and that the rest string is evaluated or spaces are stripped of. Then a space would be missing. Just try a similar line in your todo.txt

silver-dragon commented 4 years ago

16 Should fix this issue.

seanbreckenridge commented 4 years ago

If anyone doesn't want to wait on this/use a fork, I think the topydo/lib/TodoParser has a good parser for todo.txt lines.

Doesn't have the convenience functions to read/write to files, but its a good starting point to wrap if you just want to write a quick script to parse a todotxt file.

It handles both the done.txt and todo.txt files, has worked well for my use case