diff options
author | Alan Pearce | 2014-09-23 13:10:58 +0100 |
---|---|---|
committer | Alan Pearce | 2014-09-23 13:10:58 +0100 |
commit | f45945cad76b864fa4a84277f6581ffef31e225e (patch) | |
tree | efe6e121e7f1fd52fd0599ca87fa406f88143bb3 | |
parent | 58552fe2b3d5953b8bcc6a97fb87dc44bda4f180 (diff) | |
download | microformats-f45945cad76b864fa4a84277f6581ffef31e225e.tar.lz microformats-f45945cad76b864fa4a84277f6581ffef31e225e.tar.zst microformats-f45945cad76b864fa4a84277f6581ffef31e225e.zip |
Refactor property element selection and parsing
-rw-r--r-- | src/microformats/parser.clj | 13 |
1 files changed, 6 insertions, 7 deletions
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." |