diff options
-rw-r--r-- | src/microformats/parser.clj | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index 2778cc2..b993a76 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -144,8 +144,8 @@ (r/map #(hash-map % (get-e-value element))) (into {}))) -(defn parse-children - "Parse element children for microformats" +(defn parse-h + "Parse h-* classes within a HTML element." [element] (let [el (first (html/select element [(html/union [(html/attr-starts :class "p-") (html/attr-starts :class "u-") @@ -153,10 +153,10 @@ (html/attr-starts :class "e-")])]))] (hash-map :properties (apply merge ((juxt parse-p parse-u parse-dt parse-e) el))))) -(defn parse-h - "Parse h-* classes within a HTML document." +(defn select-h + "Select h-* elements within a HTML document." [element] - (mapv parse-children (html/select element [(html/attr-starts :class "h-")]))) + (html/select element [(html/attr-starts :class "h-")])) (defn parse-rel "Parse rel attributes of an HTML link element" @@ -180,4 +180,4 @@ "Parse a HTML string with microformats" [html] (let [document (html/html-snippet html)] - {:items (parse-h document) :rels (parse-rels document)})) + {:items (mapv parse-h (select-h document)) :rels (parse-rels document)})) |