From d64d535c2d753fba133ddd46d479148bc50bdd40 Mon Sep 17 00:00:00 2001 From: N-Shar-ma Date: Tue, 30 Apr 2024 22:28:27 +0530 Subject: [PATCH] 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. --- help/collaborative-to-do-lists.md | 2 +- zerver/lib/widget.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/help/collaborative-to-do-lists.md b/help/collaborative-to-do-lists.md index 1b725ee2f8..92b8434f85 100644 --- a/help/collaborative-to-do-lists.md +++ b/help/collaborative-to-do-lists.md @@ -12,7 +12,7 @@ 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 :. +3. _(optional)_ Type each task on a new line, with its description, if any, after a : and blank space. 4. Click the **Send** () button, or use a [keyboard shortcut](/help/mastering-the-compose-box#toggle-between-ctrl-enter-and-enter-to-send-a-message) diff --git a/zerver/lib/widget.py b/zerver/lib/widget.py index 0e2ee2281c..bb3672ae16 100644 --- a/zerver/lib/widget.py +++ b/zerver/lib/widget.py @@ -56,8 +56,8 @@ def parse_todo_extra_data(content: str) -> Any: task_data = re.sub(r"(\s*[-*]?\s*)", "", line.strip(), count=1) if len(task_data) > 0: # a task and its description (optional) are separated - # by the (first) `:` character - task_data_array = task_data.split(":", 1) + # by the (first) `: ` substring + task_data_array = task_data.split(": ", 1) tasks.append( { "task": task_data_array[0].strip(),