blob: 1a6bff79bfbcca7ceddf0a37f1633befbcb071cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
(ns dompa.utils)
(defmacro $ [name & opts]
(let [node# {:name (keyword name)}
attrs? (map? (first opts))
attrs (if attrs? (first opts) {})
children (if attrs? (rest opts) opts)]
(merge
node#
(when attrs?
{:attrs attrs})
(when-not (empty? children)
{:children (into [] children)}))))
(comment
(list
($ doctype {:html true})
($ head)
($ body
($ span {:class "test"}
($ span {:class "test2"})))))
|