Skip to content

Instantly share code, notes, and snippets.

@elrob
Last active August 29, 2015 14:17
Show Gist options
  • Save elrob/d0546107648c4f1c0c84 to your computer and use it in GitHub Desktop.
Save elrob/d0546107648c4f1c0c84 to your computer and use it in GitHub Desktop.
Enlive transformation experiment
(require '[net.cgrand.enlive-html :as html])
(def testfunc (html/transformation [:h2] (html/wrap :div) [:div] (html/set-attr "something" "value")))
(html/defsnippet snippet1 "templates/jade/index.html" [:h2] [] [html/any-node] testfunc [:div] (html/set-attr "tasdf" "asdfasdf"))
(snippet1)
;;=> ({:tag :div, :attrs {"tasdf" "asdfasdf", "something" "value"}, :content [{:tag :h2, :attrs {:class "navigation-title"}, :content ["Navigation"]}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment