diff options
Diffstat (limited to 'src/dompa/nodes.clj')
| -rw-r--r-- | src/dompa/nodes.clj | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/dompa/nodes.clj b/src/dompa/nodes.clj deleted file mode 100644 index 53020ba..0000000 --- a/src/dompa/nodes.clj +++ /dev/null @@ -1,26 +0,0 @@ -(ns dompa.nodes) - -(defmacro $ - "Creates a new node. Particularly useful - where you need compile-time composition over run-time, like when - combined with the `defhtml` macro to create HTML string outputs. - - Usage: - - ```clojure - ($ :div - ($ \"hello world\" )) - ```" - [name & opts] - `(if (string? ~name) - {:node/name :dompa/text - :node/value (str ~name ~@opts)} - (let [opts# (list ~@opts) - 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 children#))))) |
