From 4b44c012e63ccec2dcec10ba91258f23643de494 Mon Sep 17 00:00:00 2001 From: Paolo Donadeo Date: Tue, 25 Nov 2025 17:14:48 +0100 Subject: [PATCH] fix(parser): exclude @todo from contexts and support quoted location metadata - Prevents '@todo' from being added to task contexts. - Adds parsing for location metadata with quoted values, allowing spaces. --- internal/parser/parser.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 136c7ad..4b15373 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -172,7 +172,29 @@ func ParseLine(line string) (Task, error) { continue } if strings.HasPrefix(tok, "@") && len(tok) > 1 { - t.Contexts = append(t.Contexts, tok[1:]) + if tok != "@todo" { // exclude @todo context + t.Contexts = append(t.Contexts, tok[1:]) + } + continue + } + // Special case: location:"value with spaces" + if strings.HasPrefix(tok, "location:\"") { + val := tok[len("location:\""):] + for { + // If token ends with a quote, we've reached the end + if strings.HasSuffix(val, "\"") { + val = val[:len(val)-1] + break + } + // Otherwise, append next token + i++ + if i >= len(toks) { + // Unterminated quote, treat as is + break + } + val += " " + toks[i] + } + t.Metadata["location"] = val continue } if !strings.ContainsAny(tok, " \t") && strings.Contains(tok, ":") {