Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add prepend from Enlive. Add append-attr extension.

  • Loading branch information...
commit 486f64351c27a9e57ad123541d715010c308f2a3 1 parent 4740cba
Sean Corfield authored November 07, 2011

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  src/framework/one.clj
7  src/framework/one.clj
@@ -5,7 +5,8 @@
5 5
   (:require [net.cgrand.enlive-html :as html]))
6 6
 
7 7
 ;; Enlive bridge
8  
-(def ^:private enlive-symbols ['append 'at 'clone-for 'content 'do-> 'html-content 'remove-class 'set-attr 'substitute])
  8
+(def ^:private enlive-symbols
  9
+  ['append 'at 'clone-for 'content 'do-> 'html-content 'prepend 'remove-class 'set-attr 'substitute])
9 10
 
10 11
 (defmacro enlive-alias ^:private [sym]
11 12
   `(let [enlive-sym# (resolve (symbol (str "html/" ~sym)))]
@@ -14,6 +15,10 @@
14 15
 (doseq [sym enlive-symbols]
15 16
   (enlive-alias sym))
16 17
 
  18
+;; Enlive extensions
  19
+(defn append-attr [attr v]
  20
+  #((set-attr attr (str (get-in % [:attrs attr] "") v)) %))
  21
+
17 22
 ;; FW/1 base functionality
18 23
 
19 24
 (declare config)

0 notes on commit 486f643

Please sign in to comment.
Something went wrong with that request. Please try again.