Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

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

Open
Strubbl opened this issue May 21, 2018 · 4 comments
Open

Comments

@Strubbl
Copy link
Contributor

Strubbl commented May 21, 2018

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
Copy link
Owner

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

@Strubbl
Copy link
Contributor Author

Strubbl commented May 22, 2018

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 pushed a commit to silver-dragon/todotxtio that referenced this issue May 6, 2020
changed regex pattern to detect projects or contexts if they are proceeded by space or are at the beginning of the line.
@silver-dragon
Copy link

#16 Should fix this issue.

@purarue
Copy link

purarue commented Aug 27, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants