Template tweak
This commit is contained in:
parent
e23b0808e0
commit
626f1c5cad
@ -1,12 +1,5 @@
|
|||||||
import { WidgetContent } from "$sb/app_event.ts";
|
import { WidgetContent } from "$sb/app_event.ts";
|
||||||
import {
|
import { handlebars, markdown, space, system, YAML } from "$sb/syscalls.ts";
|
||||||
editor,
|
|
||||||
handlebars,
|
|
||||||
markdown,
|
|
||||||
space,
|
|
||||||
system,
|
|
||||||
YAML,
|
|
||||||
} from "$sb/syscalls.ts";
|
|
||||||
import { rewritePageRefs } from "$sb/lib/resolve.ts";
|
import { rewritePageRefs } from "$sb/lib/resolve.ts";
|
||||||
import { replaceTemplateVars } from "../template/template.ts";
|
import { replaceTemplateVars } from "../template/template.ts";
|
||||||
import { renderToText } from "$sb/lib/tree.ts";
|
import { renderToText } from "$sb/lib/tree.ts";
|
||||||
@ -22,8 +15,11 @@ type TemplateConfig = {
|
|||||||
raw?: boolean;
|
raw?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function widget(bodyText: string): Promise<WidgetContent> {
|
export async function widget(
|
||||||
const pageMeta = await space.getPageMeta(await editor.getCurrentPage());
|
bodyText: string,
|
||||||
|
pageName: string,
|
||||||
|
): Promise<WidgetContent> {
|
||||||
|
const pageMeta = await space.getPageMeta(pageName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const config: TemplateConfig = await YAML.parse(bodyText);
|
const config: TemplateConfig = await YAML.parse(bodyText);
|
||||||
|
Loading…
Reference in New Issue
Block a user