Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/vault/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ func localAssetTargetKind(target string) string {

// --- Task parsing (mirrors shared/tasks.ts parseTasksFromBody) ---

// taskLineRe is the app's TASK_LINE_RE (@shared/tasklists): bullets, numbered
// lists (`1.` and `1)`) and quoted tasks (`> - [ ]`), so the web app's Tasks
// view lists what the desktop lists. Group 3 starts at the `]`.
var (
taskLineRe = regexp.MustCompile(`^(\s*(?:[-*+]|\d+\.)\s+)\[( |x|X|>|-|/)\](.*)$`)
taskLineRe = regexp.MustCompile(`^(\s*(?:>\s*)*(?:[-+*]|\d+[.)])\s+\[)( |x|X|>|-|/)(\].*)$`)
inlineDueRe = regexp.MustCompile(`(?i)(?:^|\s)due:\s*(\S+)`)
inlinePriority = regexp.MustCompile(`(?i)(?:^|\s)!(high|med|medium|low|h|m|l)\b`)
inlineWaitingRe = regexp.MustCompile(`(?i)(?:^|\s)@waiting\b`)
Expand Down
20 changes: 20 additions & 0 deletions internal/vault/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ func TestExtractTagsUnicode(t *testing.T) {
}

// #450: `[-]` cancelled tasks must be parsed (not dropped) and flagged cancelled.
// The desktop's Tasks view, its MCP server and zn read these lines the same
// way (zennotes apps/desktop/src/mcp/vault-ops.test.ts, tui
// TestCLIDialectReadsEveryTaskShape); the web app's Tasks view did not list
// numbered `1)` or quoted tasks before 2.69.1.
func TestParseTasksReadsEveryTaskShape(t *testing.T) {
body := "- [ ] bullet\n1. [ ] ordered\n2) [x] ordered done\n> - [ ] quoted\n> > 3. [/] deeply quoted\n-[ ] not a task\ntext [ ] not a task\n"
tasks := ParseTasks("inbox/Shapes.md", "Shapes", FolderInbox, body)
var got []string
for _, tk := range tasks {
got = append(got, tk.Content)
}
want := []string{"bullet", "ordered", "ordered done", "quoted", "deeply quoted"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("tasks = %q, want %q", got, want)
}
if !tasks[2].Checked || !tasks[4].InProgress || tasks[3].TaskIndex != 3 {
t.Fatalf("states: ordered done checked=%v, deeply quoted in progress=%v, quoted index=%d", tasks[2].Checked, tasks[4].InProgress, tasks[3].TaskIndex)
}
}

func TestParseTasksRecognizesCancelled(t *testing.T) {
body := "- [ ] open\n- [x] done\n- [>] gone\n- [-] scrapped\n"
tasks := ParseTasks("inbox/t.md", "t", FolderInbox, body)
Expand Down
2 changes: 1 addition & 1 deletion release.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.69.0",
"version": "2.69.1",
"vendorHash": "sha256-ZdOHC2JldvnKSDUFnBUJrKD4F1IWfvYJBksgeDnU9cw="
}
Loading
Loading