ebullient/obsidian-task-collector

Resetting a task does not remove appended text for certain cases

Closed this issue · 5 comments

[✅ ]YYYY-MM-DD[T]HH:mm would result in ✅ 2022-12-29T12:00, and the text can be removed when resetting a task.

[[completion::]YYYY-MM-DD[] ✅ ]YYYY-MM-DD[T]HH:mm would result in [completion::2022-12-29] ✅ 2022-12-29T12:00. However, when resetting a task, the appended text would not be removed.

This is tricky. Moment does not have the strictest syntax for working with date strings.. so what works for moment does not work for constructing a regex that can undo it. ;)
Will have to think on it.

Specifically, if I swap the troublesome braces with an emoji, you'll be able to see that it works:

[⎡completion::]YYYY-MM-DD[⎤ ✅ ]YYYY-MM-DD[T]HH:mm

I'll probably have to tokenize the string instead

so what works for moment does not work for constructing a regex that can undo it. ;)

I wonder if the opposite is true, i.e., regex can be used to remove any text that moment results in. If so, maybe a separate regex can be formulated to remove the string, regardless if it is given by regex or not. Or is this the tokenizing the string method you mentioned?

I have to read the input string character by character so I can find the correct bracket..

  • for this one: [[completion::]: which one belongs in the constant string? You might be able to get there w/ look-behind, but that fails on mobile.
  • for this one: [] ✅ ] you need the second close bracket rather than the first.

This also gets confusing [[things]]: the outermost of both should win. Non-trivial, but really hard with a regex.

Constraints of mobile (around supported regex functionality) also make this more complicated.

I see. Thanks for the clarifications!