MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / parseNoteDefaults

Function parseNoteDefaults

apps/server/internal/vault/parse.go:267–298  ·  view source on GitHub ↗
(body string)

Source from the content-addressed store, hash-verified

265}
266
267func parseNoteDefaults(body string) noteDefaults {
268 m := frontmatterRe.FindStringSubmatch(body)
269 if len(m) < 2 {
270 return noteDefaults{}
271 }
272 var d noteDefaults
273 for _, line := range strings.Split(m[1], "\n") {
274 trimmed := strings.TrimSpace(line)
275 if trimmed == "" || strings.HasPrefix(trimmed, "#") {
276 continue
277 }
278 colon := strings.IndexByte(trimmed, ':')
279 if colon < 1 {
280 continue
281 }
282 key := strings.ToLower(strings.TrimSpace(trimmed[:colon]))
283 val := unquote(strings.TrimSpace(trimmed[colon+1:]))
284 switch key {
285 case "due":
286 if isValidIsoDate(val) {
287 d.Due = val
288 }
289 case "priority":
290 if p := normalizePriority(val); p != "" {
291 d.Priority = p
292 }
293 case "status":
294 d.Status = strings.ToLower(val)
295 }
296 }
297 return d
298}
299
300func unquote(v string) string {
301 t := strings.TrimSpace(v)

Callers 1

ParseTasksFunction · 0.70

Calls 3

unquoteFunction · 0.70
isValidIsoDateFunction · 0.70
normalizePriorityFunction · 0.70

Tested by

no test coverage detected