diff options
-rw-r--r-- | src/microformats/parser.clj | 3 | ||||
-rw-r--r-- | test/microformats/parser_expectations.clj | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index ab14cd6..5786f7c 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -192,7 +192,8 @@ [element] (case (:tag element) :a (-> element :attrs :href) - nil)) + (if-let [% (first (html/select element [html/root :> [:a (html/attr? :href) html/only-of-type (html/but-node (html/attr-contains :class "h-"))]]))] + (-> % :attrs :href)))) (defn- parse-implied-photo [element] diff --git a/test/microformats/parser_expectations.clj b/test/microformats/parser_expectations.clj index 639c417..5c9984d 100644 --- a/test/microformats/parser_expectations.clj +++ b/test/microformats/parser_expectations.clj @@ -169,6 +169,10 @@ :photo '("http://example.com/me.png")}}] :rels {}} (parse "<div class=\"h-card\"><div><img alt=\"Example User\" src=\"http://example.com/me.png\"></div></div>")) +(expect {:items [{:type ["h-card"] :properties {:name '("Example User") :url '("http://example.com")}}] :rels {}} + (parse "<div class=\"h-card\"><a href=\"http://example.com\">Example User</a></div>")) + + (expect {:items [{:type ["h-adr"], :properties {:street-address '("665 3rd St."), |