1
0
silverbullet/common/query_functions.ts
Zef Hemel f30b1d3418
Templates 2.0 (#636)
Templates 2.0 and a whole bunch of other refactoring
2024-01-20 19:16:07 +01:00

16 lines
488 B
TypeScript

import { FunctionMap } from "$sb/types.ts";
import { builtinFunctions } from "$sb/lib/builtin_query_functions.ts";
export function buildQueryFunctions(allKnownPages: Set<string>): FunctionMap {
return {
...builtinFunctions,
pageExists: (name: string) => {
if (name.startsWith("!") || name.startsWith("{{")) {
// Let's assume federated pages exist, and ignore template variable ones
return true;
}
return allKnownPages.has(name);
},
};
}