Add table to builtins
parent
4056c4f2f2
commit
702474dca1
|
@ -91,6 +91,11 @@ export const builtins: Record<string, Record<string, string>> = {
|
|||
pos: "!number",
|
||||
hooks: "hooksSpec",
|
||||
},
|
||||
table: {
|
||||
ref: "!string",
|
||||
page: "!string",
|
||||
pos: "!number",
|
||||
},
|
||||
|
||||
// System builtins
|
||||
syscall: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CompleteEvent, IndexTreeEvent, ObjectValue } from "$type/types.ts";
|
||||
import { IndexTreeEvent, ObjectValue } from "$type/types.ts";
|
||||
import { collectNodesMatching, ParseTree } from "$lib/tree.ts";
|
||||
import { indexObjects } from "./api.ts";
|
||||
import { collectNodesOfType } from "$lib/tree.ts";
|
||||
|
@ -30,7 +30,6 @@ function concatChildrenTexts(nodes: ParseTree[]): string {
|
|||
}
|
||||
|
||||
export async function indexTables({ name: pageName, tree }: IndexTreeEvent) {
|
||||
console.log(`Indexing tables in '${pageName}'`);
|
||||
const result: ObjectValue<TableRowObject>[] = [];
|
||||
|
||||
collectNodesMatching(tree, (t) => !!t.type?.startsWith("Table")).forEach(
|
||||
|
@ -65,12 +64,9 @@ export async function indexTables({ name: pageName, tree }: IndexTreeEvent) {
|
|||
tableRow[label!] = content;
|
||||
});
|
||||
result.push(tableRow);
|
||||
|
||||
//console.log("Cells", cells);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
console.log("Found", result.length, "row(s)");
|
||||
await indexObjects(pageName, result);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue