Last active
December 23, 2015 10:08
-
-
Save Jared314/6618903 to your computer and use it in GitHub Desktop.
Remove nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[net.cgrand.enlive-html :as e]) | |
(defn gen-transform [target] | |
[[(cond | |
(string? target) e/text-node | |
(map? target) (:tag target) | |
:else e/any-node)] | |
#(when (not= target %) %)]) | |
(defn remove-node [coll & nodes] | |
(e/at* coll (map gen-transform nodes))) | |
(remove-node enlive-node | |
{:tag :title, :attrs nil, :content ["Stack Overflow"]} | |
"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment