diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/microformats/parser.clj | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index 9712108..934a0a3 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -171,15 +171,20 @@ [element] {:name (imply-name element)}) +(defn get-mf-properties + "Parse children of a microformat, returning a map of properties" + [element] + (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 parse-h "Parse h-* classes within a HTML element." [element] (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-")])))))) + :properties (get-mf-properties element))) (defn select-h "Select h-* elements within a HTML document." |