Work on inline attributes
This commit is contained in:
+8
-1
@@ -23,6 +23,7 @@ import {
|
||||
} from "$sb/lib/tree.ts";
|
||||
import { applyQuery, removeQueries } from "$sb/lib/query.ts";
|
||||
import { niceDate } from "$sb/lib/dates.ts";
|
||||
import { extractAttributes } from "$sb/lib/attribute.ts";
|
||||
|
||||
export type Task = {
|
||||
name: string;
|
||||
@@ -33,7 +34,7 @@ export type Task = {
|
||||
// Not saved in DB, just added when pulled out (from key)
|
||||
pos?: number;
|
||||
page?: string;
|
||||
};
|
||||
} & Record<string, any>;
|
||||
|
||||
function getDeadline(deadlineNode: ParseTree): string {
|
||||
return deadlineNode.children![0].text!.replace(/📅\s*/, "");
|
||||
@@ -67,6 +68,12 @@ export async function indexTasks({ name, tree }: IndexTreeEvent) {
|
||||
}
|
||||
});
|
||||
|
||||
// Extract attributes and remove from tree
|
||||
const extractedAttributes = extractAttributes(n, true);
|
||||
for (const [key, value] of Object.entries(extractedAttributes)) {
|
||||
task[key] = value;
|
||||
}
|
||||
|
||||
task.name = n.children!.slice(1).map(renderToText).join("").trim();
|
||||
|
||||
const taskIndex = n.parent!.children!.indexOf(n);
|
||||
|
||||
Reference in New Issue
Block a user