From f45945cad76b864fa4a84277f6581ffef31e225e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 Sep 2014 13:10:58 +0100 Subject: Refactor property element selection and parsing --- src/microformats/parser.clj | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index fb0dc0d..9712108 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -174,13 +174,12 @@ (defn parse-h "Parse h-* classes within a HTML element." [element] - (let [el (html/select element [(html/union [(html/attr-starts :class "p-") - (html/attr-starts :class "u-") - (html/attr-starts :class "dt-") - (html/attr-starts :class "e-")])])] - (hash-map :type (get-mf-names element) - :properties (merge (parse-implied element) - (apply merge (map #(apply merge %) (map (juxt parse-p parse-u parse-dt parse-e) el))))))) + (hash-map :type (get-mf-names element) + :properties (merge (parse-implied element) + (apply merge (map parse-p (html/select element [(html/attr-starts :class "p-")]))) + (apply merge (map parse-u (html/select element [(html/attr-starts :class "u-")]))) + (apply merge (map parse-dt (html/select element [(html/attr-starts :class "dt-")]))) + (apply merge (map parse-e (html/select element [(html/attr-starts :class "e-")])))))) (defn select-h "Select h-* elements within a HTML document." -- cgit 1.4.1