@branch14 okay, the code I gave you the other day was a bit more simple than it should have been. I was able to make it work (as in, I actually ran the code), with this:
(deftask global-assortment
"Renders an assortment using global metadata"
[o out-dir OUTDIR str "the output directory"
r renderer RENDERER sym "page renderer (fully qualified symbol resolving to a function)"]
(fn [next-task]
(fn [fileset]
(let [global-meta (io.perun.meta/get-global-meta fileset)
task-fn (perun/assortment-task {:task-name "global-assortment"
:renderer renderer
:out-dir out-dir
:filterer identity
;;:extensions [".html"]
:sortby :date-published
:comparator (fn [i1 i2] (compare i2 i1))
:tracer :your.ns/global-assortment
:grouper (partial my-grouper global-meta)})]
((task-fn next-task) fileset)))))
The problem with the task I wrote earlier is that it was wrapping the task that gets returned from assortment-task
, but not actually calling it. And then, it looks like you resolved the error that that caused (task must return fileset, or something like that) by returning the original fileset. That runs, but still doesn't actually execute the return value of assortment-task
. To make it work, I used an explicit middleware pattern, instead of with-pre-wrap
.
@bhagany Perfect! Just tried it and it works beautifully. Thank you very much!
Glad to help!