Created
March 21, 2014 04:55
-
-
Save hby/9679750 to your computer and use it in GitHub Desktop.
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
(ns haglure.core | |
(:require [net.cgrand.enlive-html :as html])) | |
(def layout | |
(html/html-resource "test.html")) | |
(defn scope [n] | |
(:data-scope (:attrs n))) | |
(def scopes (html/select layout [(html/attr? :data-scope)])) | |
(count scopes) | |
(map scope scopes) | |
(def posts (html/select layout [(html/attr= :data-scope "post")])) | |
(def post-comments (html/select posts [(html/attr= :data-scope "comment")])) | |
(def comments (html/select layout [(html/attr= :data-scope "comment")])) |
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
<html> | |
<body> | |
<h1>Posts</h1> | |
<div class="post" data-scope="post"> | |
<h2 data-prop="title">Title</h2> | |
<p class="body" data-prop="body">Body</p> | |
<div class="comment" data-scope="comment"> | |
<p data-prop="body">Comment</p> | |
</div> | |
</div> | |
<div class="comment" data-scope="comment"> | |
<p>Free Comment</p> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment