( frontmatter: UnknownRecord, mapping: SpecFieldMapping, now: Date )
| 219 | } |
| 220 | |
| 221 | function buildTemplateValues( |
| 222 | frontmatter: UnknownRecord, |
| 223 | mapping: SpecFieldMapping, |
| 224 | now: Date |
| 225 | ): Record<string, string> { |
| 226 | const values: Record<string, string> = {}; |
| 227 | |
| 228 | const titleField = resolveField(mapping, "title"); |
| 229 | const priorityField = resolveField(mapping, "priority"); |
| 230 | const statusField = resolveField(mapping, "status"); |
| 231 | const dueField = resolveField(mapping, "due"); |
| 232 | const scheduledField = resolveField(mapping, "scheduled"); |
| 233 | const contextsField = resolveField(mapping, "contexts"); |
| 234 | const projectsField = resolveField(mapping, "projects"); |
| 235 | const tagsField = resolveField(mapping, "tags"); |
| 236 | const estimateField = resolveField(mapping, "timeEstimate"); |
| 237 | |
| 238 | const rawTitle = readString(frontmatter[titleField]) || readString(frontmatter.title) || "task"; |
| 239 | const title = sanitizeForPathSegment(rawTitle); |
| 240 | const priority = sanitizeForPathSegment( |
| 241 | readString(frontmatter[priorityField]) || readString(frontmatter.priority) || "normal" |
| 242 | ); |
| 243 | const status = sanitizeForPathSegment( |
| 244 | readString(frontmatter[statusField]) || readString(frontmatter.status) || "open" |
| 245 | ); |
| 246 | |
| 247 | const dueDate = readString(frontmatter[dueField]) || readString(frontmatter.due) || ""; |
| 248 | const scheduledDate = |
| 249 | readString(frontmatter[scheduledField]) || readString(frontmatter.scheduled) || ""; |
| 250 | const titleWords = splitWords(rawTitle); |
| 251 | |
| 252 | const contexts = readStringList(frontmatter[contextsField] ?? frontmatter.contexts) |
| 253 | .map(sanitizeForPathSegment) |
| 254 | .join("-"); |
| 255 | const projects = readStringList(frontmatter[projectsField] ?? frontmatter.projects) |
| 256 | .map(sanitizeForPathSegment) |
| 257 | .join("-"); |
| 258 | const tags = readStringList(frontmatter[tagsField] ?? frontmatter.tags) |
| 259 | .map(sanitizeForPathSegment) |
| 260 | .join("-"); |
| 261 | const timeEstimate = readString(frontmatter[estimateField] ?? frontmatter.timeEstimate) || ""; |
| 262 | |
| 263 | values.title = title; |
| 264 | values.priority = priority; |
| 265 | values.priorityShort = priority ? priority.slice(0, 3).toLowerCase() : ""; |
| 266 | values.status = status; |
| 267 | values.statusShort = status ? status.slice(0, 3).toLowerCase() : ""; |
| 268 | values.due = dueDate; |
| 269 | values.dueDate = dueDate; |
| 270 | values.scheduled = scheduledDate; |
| 271 | values.scheduledDate = scheduledDate; |
| 272 | values.titleKebab = toKebabCase(titleWords); |
| 273 | values.titleSnake = toSnakeCase(titleWords); |
| 274 | values.titleCamel = toCamelCase(titleWords); |
| 275 | values.titlePascal = toPascalCase(titleWords); |
| 276 | values.titleUpper = rawTitle.toUpperCase(); |
| 277 | values.titleLower = rawTitle.toLowerCase(); |
| 278 | values.contexts = contexts; |
no test coverage detected