todo: Require space after colon to separate task title from description.

This fixes the annoying behaviour where a task title with a url in it,
for example, "Fix issue https://github/com/zulip/zulip/issues/1234"
would be wrongly split into a description at the `:` in the url.
This commit is contained in:
N-Shar-ma 2024-04-30 22:28:27 +05:30 committed by Tim Abbott
parent 2457a8b655
commit d64d535c2d
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@
2. Type `/todo` followed by a space, and the title of the to-do list. 2. Type `/todo` followed by a space, and the title of the to-do list.
3. _(optional)_ Type each task on a new line, with its description, if any, after a <kbd>:</kbd>. 3. _(optional)_ Type each task on a new line, with its description, if any, after a <kbd>:</kbd> and blank space.
4. Click the **Send** (<i class="zulip-icon zulip-icon-send"></i>) button, or 4. Click the **Send** (<i class="zulip-icon zulip-icon-send"></i>) button, or
use a [keyboard shortcut](/help/mastering-the-compose-box#toggle-between-ctrl-enter-and-enter-to-send-a-message) use a [keyboard shortcut](/help/mastering-the-compose-box#toggle-between-ctrl-enter-and-enter-to-send-a-message)

View File

@ -56,8 +56,8 @@ def parse_todo_extra_data(content: str) -> Any:
task_data = re.sub(r"(\s*[-*]?\s*)", "", line.strip(), count=1) task_data = re.sub(r"(\s*[-*]?\s*)", "", line.strip(), count=1)
if len(task_data) > 0: if len(task_data) > 0:
# a task and its description (optional) are separated # a task and its description (optional) are separated
# by the (first) `:` character # by the (first) `: ` substring
task_data_array = task_data.split(":", 1) task_data_array = task_data.split(": ", 1)
tasks.append( tasks.append(
{ {
"task": task_data_array[0].strip(), "task": task_data_array[0].strip(),