all repos — archive/microformats @ 16c845fbe5963f29c6b65991ef792ace84893673

Incomplete Clojure microformats library

Parse an empty document correctly

Alan Pearce
commit

16c845fbe5963f29c6b65991ef792ace84893673

parent

d44305ac37fe2d92aad4bb0ef5602133050d4f2a

2 files changed, 4 insertions(+), 1 deletion(-)

jump to
M src/microformats/parser.cljsrc/microformats/parser.clj
@@ -157,7 +157,7 @@
(defn parse-rels "Parse rel attibutes of a set of HTML link elements" [elements] - (apply merge-with into (map parse-rel (select-rels elements)))) + (or (apply merge-with into (map parse-rel (select-rels elements))) {})) (defn parse "Parse a HTML string with microformats"
M test/microformats/parser_expectations.cljtest/microformats/parser_expectations.clj
@@ -99,3 +99,6 @@
(expect {:author ["http://example.com/a" "http://example.com/b"]} (parse-rels (html-snippet "<a rel=\"author\" href=\"http://example.com/a\">author a</a> <a rel=\"author\" href=\"http://example.com/b\">author b</a>"))) + +(expect {:items [] :rels {}} + (parse ""))