fixed regression where priority was still listed raw before task
This commit is contained in:
parent
209925146e
commit
29b746235c
1 changed files with 7 additions and 2 deletions
|
|
@ -85,11 +85,16 @@ func extractPriority(line string) (int, error) {
|
||||||
return 9, nil // Default priority if none is found
|
return 9, nil // Default priority if none is found
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to extract the task from the TODO comment
|
// Function to extract the task from the TODO comment and remove the priority
|
||||||
func extractTask(line string) string {
|
func extractTask(line string) string {
|
||||||
trimmedLine := strings.TrimSpace(line)
|
trimmedLine := strings.TrimSpace(line)
|
||||||
trimmedLine = strings.TrimPrefix(trimmedLine, "//TODO: ")
|
trimmedLine = strings.TrimPrefix(trimmedLine, "//TODO: ")
|
||||||
return strings.TrimSpace(trimmedLine)
|
|
||||||
|
// Remove the priority part (P:<digit>) if it exists
|
||||||
|
re := regexp.MustCompile(`P:\d+`)
|
||||||
|
trimmedLine = re.ReplaceAllString(trimmedLine, "")
|
||||||
|
|
||||||
|
return strings.TrimSpace(trimmedLine) // Return the task without priority
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: P:0 add support for TODO's not at start of line
|
//TODO: P:0 add support for TODO's not at start of line
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue