From 6d5093970156cc85794c9a5f503f93c9989d461b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 Sep 2014 20:53:25 +0100 Subject: Parse mf names into type array --- src/microformats/parser.clj | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index b993a76..38bca21 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -144,6 +144,14 @@ (r/map #(hash-map % (get-e-value element))) (into {}))) +(defn- get-mf-names + "Get the microformat names from an element" + [element] + (->> element + element-to-classes + (r/filter (mf-names-from-class "h-")) + (into []))) + (defn parse-h "Parse h-* classes within a HTML element." [element] @@ -151,7 +159,8 @@ (html/attr-starts :class "u-") (html/attr-starts :class "dt-") (html/attr-starts :class "e-")])]))] - (hash-map :properties (apply merge ((juxt parse-p parse-u parse-dt parse-e) el))))) + (hash-map :type (get-mf-names element) + :properties (apply merge ((juxt parse-p parse-u parse-dt parse-e) el))))) (defn select-h "Select h-* elements within a HTML document." -- cgit 1.4.1