* Process a folder path template with task and date variables * * This method enables dynamic folder creation by replacing template variables * with actual values from the task data and current date. * * Supported task variables: * - {{context}} - First context from the task's contexts a
( folderTemplate: string, taskData?: TaskCreationData, date: Date = new Date() )
| 242 | * // Returns: "ProjectName/high" |
| 243 | */ |
| 244 | private processFolderTemplate( |
| 245 | folderTemplate: string, |
| 246 | taskData?: TaskCreationData, |
| 247 | date: Date = new Date() |
| 248 | ): string { |
| 249 | // Convert TaskCreationData to TaskTemplateData |
| 250 | const templateData: TaskTemplateData | undefined = taskData |
| 251 | ? { |
| 252 | title: taskData.title, |
| 253 | priority: taskData.priority, |
| 254 | status: taskData.status, |
| 255 | contexts: taskData.contexts, |
| 256 | projects: taskData.projects, |
| 257 | due: taskData.due, |
| 258 | scheduled: taskData.scheduled, |
| 259 | } |
| 260 | : undefined; |
| 261 | |
| 262 | // Use the shared folder template processor utility |
| 263 | return processFolderTemplate(folderTemplate, { |
| 264 | date, |
| 265 | taskData: templateData, |
| 266 | extractProjectBasename: (project) => this.extractProjectBasename(project), |
| 267 | extractProjectFilePath: (project) => this.extractProjectFilePath(project), |
| 268 | }); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Create a new task file with all the necessary setup |
no test coverage detected