Skip to content

Instantly share code, notes, and snippets.

Created March 21, 2014 04:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hby/9679750 to your computer and use it in GitHub Desktop.
(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")]))
<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 class="comment" data-scope="comment">
<p>Free Comment</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment