From d98e13761fdcaa8cba912d367670855087b29c01 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Wed, 24 Sep 2025 21:57:57 +0300 Subject: Improve $ macro clj-kondo hook, impl fragment node (well, not really a node itself, but any node with a name of :<> will replace itself with its children. --- src/dompa/utils.cljc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/dompa/utils.cljc') diff --git a/src/dompa/utils.cljc b/src/dompa/utils.cljc index 9e1cb27..0396e8a 100644 --- a/src/dompa/utils.cljc +++ b/src/dompa/utils.cljc @@ -12,12 +12,12 @@ (fn [rf] (letfn [(step [result input] (if (sequential? input) - (reduce step result input) ;; recursively reduce over nested seq - (rf result input)))] ;; apply rf with accumulator + value + (reduce step result input) + (rf result input)))] (fn - ([] (rf)) ;; init - ([result] (rf result)) ;; completion - ([result input] (step result input)))))) ;; step + ([] (rf)) + ([result] (rf result)) + ([result input] (step result input)))))) (defn ->flat [children] (into [] (->flat-xf) children)) @@ -39,9 +39,10 @@ (defhtml test-page [] (let [n 123] - ($ :div - ($ "hello world" n)) - ($ "hello") - ($ :div (map #(%) []) "test"))) + ($ :<> + ($ :div + ($ "hello world" n)) + ($ "hello") + ($ :div)))) (test-page) -- cgit v1.2.3