mirror of
https://github.com/rioskit/obsidian-todo-txt-mode.git
synced 2026-07-22 05:49:24 +00:00
- Implement task watcher for real-time monitoring and auto-completion dates - Add support for recurring tasks (daily, weekly, monthly, yearly, business days) - Refactor parser and sorter tests for better maintainability - Add comprehensive test coverage for new features
30 lines
No EOL
689 B
TypeScript
30 lines
No EOL
689 B
TypeScript
import { TodoInterface } from './parser';
|
|
|
|
export function buildTaskString(task: TodoInterface): string {
|
|
let taskStr = '';
|
|
|
|
if (task.priority()) {
|
|
taskStr += `(${task.priority()}) `;
|
|
}
|
|
|
|
if (task.creationDate()) {
|
|
taskStr += `${task.creationDate()} `;
|
|
}
|
|
|
|
taskStr += task.task();
|
|
|
|
for (const project of task.projects()) {
|
|
taskStr += ` +${project}`;
|
|
}
|
|
|
|
for (const context of task.contexts()) {
|
|
taskStr += ` @${context}`;
|
|
}
|
|
|
|
const keyValues = task.keyValues();
|
|
for (const [key, value] of Object.entries(keyValues)) {
|
|
taskStr += ` ${key}:${value}`;
|
|
}
|
|
|
|
return taskStr;
|
|
} |