Improve handling tags + improve combine bullets in ntfy backend

This commit is contained in:
2025-06-11 13:33:53 +02:00
parent bff145d27f
commit 0060b2be60
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ labelWhitespace = whitespace:[ \t\r]+ {
} }
} }
tag = "#" tag:[a-zA-Z0-9-]+ { tag = "#" tag:[a-zA-Z0-9-/]+ {
return { return {
span: "tag", span: "tag",
value: tag.join("") value: tag.join("")

View File

@@ -164,10 +164,10 @@ function defaultMapper(task: Task): NtfyDTO {
} }
} }
function defaultCombineMapper(tasks: Task[], bullet = "-"): NtfyDTO { function defaultCombineMapper(tasks: Task[], bullet = (index: number) => "-"): NtfyDTO {
const text = tasks const text = tasks
.toSorted((a, b) => b.priority - a.priority) .toSorted((a, b) => b.priority - a.priority)
.map(t => `${bullet} ${t.label}`) .map((t, i) => `${bullet(i)} ${t.label}`)
.join("\n"); .join("\n");
const priority = mapPriority(Math.max(...tasks.map(t => t.priority))); const priority = mapPriority(Math.max(...tasks.map(t => t.priority)));