1
0

Template tweak

This commit is contained in:
Zef Hemel 2023-11-02 12:51:09 +01:00
parent e23b0808e0
commit 626f1c5cad

View File

@ -1,12 +1,5 @@
import { WidgetContent } from "$sb/app_event.ts";
import {
editor,
handlebars,
markdown,
space,
system,
YAML,
} from "$sb/syscalls.ts";
import { handlebars, markdown, space, system, YAML } from "$sb/syscalls.ts";
import { rewritePageRefs } from "$sb/lib/resolve.ts";
import { replaceTemplateVars } from "../template/template.ts";
import { renderToText } from "$sb/lib/tree.ts";
@ -22,8 +15,11 @@ type TemplateConfig = {
raw?: boolean;
};
export async function widget(bodyText: string): Promise<WidgetContent> {
const pageMeta = await space.getPageMeta(await editor.getCurrentPage());
export async function widget(
bodyText: string,
pageName: string,
): Promise<WidgetContent> {
const pageMeta = await space.getPageMeta(pageName);
try {
const config: TemplateConfig = await YAML.parse(bodyText);