Attributes now have YAML values

This commit is contained in:
Zef Hemel
2023-07-26 17:12:56 +02:00
parent 5481e49393
commit 7b8d8af2c1
12 changed files with 139 additions and 54 deletions
+5 -5
View File
@@ -22,13 +22,13 @@ export async function indexItems({ name, tree }: IndexTreeEvent) {
const coll = collectNodesOfType(tree, "ListItem");
coll.forEach((n) => {
for (const n of coll) {
if (!n.children) {
return;
continue;
}
if (collectNodesOfType(n, "Task").length > 0) {
// This is a task item, skip it
return;
continue;
}
const item: Item = {
@@ -43,7 +43,7 @@ export async function indexItems({ name, tree }: IndexTreeEvent) {
break;
}
// Extract attributes and remove from tree
const extractedAttributes = extractAttributes(child, true);
const extractedAttributes = await extractAttributes(child, true);
for (const [key, value] of Object.entries(extractedAttributes)) {
item[key] = value;
}
@@ -66,7 +66,7 @@ export async function indexItems({ name, tree }: IndexTreeEvent) {
key: `it:${n.from}`,
value: item,
});
});
}
// console.log("Found", items.length, "item(s)");
await index.batchSet(name, items);
}
+1 -1
View File
@@ -43,7 +43,7 @@ export async function indexLinks({ name, tree }: IndexTreeEvent) {
// [[Style Links]]
// console.log("Now indexing links for", name);
const pageMeta = await extractFrontmatter(tree);
const toplevelAttributes = extractAttributes(tree, false);
const toplevelAttributes = await extractAttributes(tree, false);
if (
Object.keys(pageMeta).length > 0 ||
Object.keys(toplevelAttributes).length > 0