Rewrite page references in federated pages
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { handlebars, space } from "$sb/syscalls.ts";
|
||||
import { handlebarHelpers } from "../../common/syscalls/handlebar_helpers.ts";
|
||||
import { PageMeta } from "$sb/types.ts";
|
||||
import { cleanTemplate, renderTemplate } from "../template/plug_api.ts";
|
||||
import { cleanTemplate } from "../template/plug_api.ts";
|
||||
|
||||
export function defaultJsonTransformer(_k: string, v: any) {
|
||||
if (v === undefined) {
|
||||
@@ -62,6 +62,7 @@ export async function renderQueryTemplate(
|
||||
): Promise<string> {
|
||||
let templateText = await space.readPage(templatePage);
|
||||
templateText = await cleanTemplate(templateText);
|
||||
|
||||
if (!renderAll) {
|
||||
templateText = `{{#each .}}\n${templateText}\n{{/each}}`;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ requiredPermissions:
|
||||
functions:
|
||||
listFiles:
|
||||
path: ./federation.ts:listFiles
|
||||
env: server
|
||||
pageNamespace:
|
||||
pattern: "!.+"
|
||||
operation: listFiles
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { WidgetContent } from "$sb/app_event.ts";
|
||||
import { markdown, space, system, YAML } from "$sb/syscalls.ts";
|
||||
import { rewritePageRefs } from "$sb/lib/resolve.ts";
|
||||
import { loadPageObject, replaceTemplateVars } from "../template/template.ts";
|
||||
import { renderToText } from "$sb/lib/tree.ts";
|
||||
import { PageMeta } from "$sb/types.ts";
|
||||
import { renderTemplate } from "../template/plug_api.ts";
|
||||
import { renderToText } from "$sb/lib/tree.ts";
|
||||
import { rewritePageRefs } from "$sb/lib/resolve.ts";
|
||||
|
||||
type TemplateConfig = {
|
||||
// Pull the template from a page
|
||||
@@ -40,8 +40,6 @@ export async function widget(
|
||||
)
|
||||
: undefined;
|
||||
|
||||
console.log("Value", value);
|
||||
|
||||
let { text: rendered } = config.raw
|
||||
? { text: templateText }
|
||||
: await renderTemplate(
|
||||
|
||||
Reference in New Issue
Block a user