Skip to content

Commit

Permalink
Add prepend from Enlive. Add append-attr extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Nov 7, 2011
1 parent 4740cba commit 486f643
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/framework/one.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
(:require [net.cgrand.enlive-html :as html]))

;; Enlive bridge
(def ^:private enlive-symbols ['append 'at 'clone-for 'content 'do-> 'html-content 'remove-class 'set-attr 'substitute])
(def ^:private enlive-symbols
['append 'at 'clone-for 'content 'do-> 'html-content 'prepend 'remove-class 'set-attr 'substitute])

(defmacro enlive-alias ^:private [sym]
`(let [enlive-sym# (resolve (symbol (str "html/" ~sym)))]
Expand All @@ -14,6 +15,10 @@
(doseq [sym enlive-symbols]
(enlive-alias sym))

;; Enlive extensions
(defn append-attr [attr v]
#((set-attr attr (str (get-in % [:attrs attr] "") v)) %))

;; FW/1 base functionality

(declare config)
Expand Down

0 comments on commit 486f643

Please sign in to comment.