From f8d1e6ee6e27e5539d50191b94a79d1fcb797939 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jun 2023 12:36:24 -0300 Subject: infra, test: expose "native" slots opt for quickEvaluate --- src/content-function.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/content-function.js b/src/content-function.js index d4cc3dbc..18092707 100644 --- a/src/content-function.js +++ b/src/content-function.js @@ -450,6 +450,7 @@ export function quickEvaluate({ name, args = [], + slots = null, multiple = null, postprocess = null, }) { @@ -462,6 +463,7 @@ export function quickEvaluate({ ...opts, name: opts.name ?? name, args: opts.args ?? args, + slots: opts.slots ?? slots, postprocess: opts.postprocess ?? postprocess, })); } @@ -560,11 +562,15 @@ export function quickEvaluate({ slotResults[slot] = runContentFunction(flatRelationSlots[slot]); } - const topLevelResult = runContentFunction(root); + let topLevelResult = runContentFunction(root); - if (postprocess !== null) { - return postprocess(topLevelResult); - } else { - return topLevelResult; + if (slots) { + topLevelResult.setSlots(slots); + } + + if (postprocess) { + topLevelResult = postprocess(topLevelResult); } + + return topLevelResult; } -- cgit 1.3.0-6-gf8a5