summaryrefslogtreecommitdiff
path: root/src/dompa
diff options
context:
space:
mode:
Diffstat (limited to 'src/dompa')
-rw-r--r--src/dompa/nodes.cljc27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/dompa/nodes.cljc b/src/dompa/nodes.cljc
index e717690..58ff045 100644
--- a/src/dompa/nodes.cljc
+++ b/src/dompa/nodes.cljc
@@ -110,28 +110,6 @@
`(defn ~name ~args
(->html (vector ~@elements)))))
-(defn $$
- "Creates a new node
-
- Usage:
-
- ```clojure
- ($ :div
- ($ \"hello world\" ))
- ```"
- [name & opts]
- (if (string? name)
- {:node/name :dompa/text
- :node/value (apply str name opts)}
- (let [first-opt (first opts)
- attrs? (and (map? first-opt)
- (not (contains? first-opt :node/name)))
- attrs (if attrs? first-opt {})
- children (if attrs? (rest opts) opts)]
- (cond-> {:node/name name}
- attrs? (assoc :node/attrs attrs)
- (seq children) (assoc :node/children (flatten children))))))
-
(defn- list-of-one?
[coll]
(and (sequential? coll)
@@ -160,10 +138,11 @@
(list-of-many? opt)
{:node/name :<>
- :node/children (remove nil? opt)}
+ :node/children (->> (map nodes-from-opt opt)
+ (remove nil?))}
(list-of-one? opt)
- (first opt)
+ (nodes-from-opt (first opt))
:else
{:node/name :dompa/text