« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content-function.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content-function.js')
-rw-r--r--src/content-function.js16
1 files 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;
 }