about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/microformats/parser.clj20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj
index 03e543f..4706992 100644
--- a/src/microformats/parser.clj
+++ b/src/microformats/parser.clj
@@ -222,15 +222,27 @@
                     :url (list (parse-implied-url element))
                     :photo (list (parse-implied-photo element))})))
 
+(defn- select-p
+  [element] (html/select element [(html/attr-contains :class "p-")]))
+
+(defn- select-u
+  [element] (html/select element [(html/attr-contains :class "u-")]))
+
+(defn- select-dt
+  [element] (html/select element [(html/attr-contains :class "dt-")]))
+
+(defn- select-e
+  [element] (html/select element [(html/attr-contains :class "e-")]))
+
 (defn get-mf-properties
   "Parse children of a microformat, returning a map of properties"
   [element]
   (let [cappend (partial merge-with concat)]
     (merge (parse-implied element)
-           (apply cappend (map parse-p (html/select element [(html/attr-contains :class "p-")])))
-           (apply cappend (map parse-u (html/select element [(html/attr-contains :class "u-")])))
-           (apply cappend (map parse-dt (html/select element [(html/attr-contains :class "dt-")])))
-           (apply cappend (map parse-e (html/select element [(html/attr-contains :class "e-")]))))))
+           (apply cappend (map parse-p (select-p element)))
+           (apply cappend (map parse-u (select-u element)))
+           (apply cappend (map parse-dt (select-dt element)))
+           (apply cappend (map parse-e (select-e element))))))
 
 (defn parse-h
   "Parse h-* classes within a HTML element."