all repos — archive/microformats @ b14be70cb06dc34dfc1823c5cf5151a798ac7379

Incomplete Clojure microformats library

Ignore <br> and <hr>, even if they have mf classes This isn't actually in the spec, but microformats-tests expects it.

Alan Pearce
commit

b14be70cb06dc34dfc1823c5cf5151a798ac7379

parent

abce14ea6914678045a0d69adf182e5a2d5b5ee1

2 files changed, 14 insertions(+), 4 deletions(-)

changed files
M src/microformats/parser.cljsrc/microformats/parser.clj
@@ -223,16 +223,16 @@ :url (list (parse-implied-url element))
:photo (list (parse-implied-photo element))}))) (defn- select-p - [element] (html/select element [(html/attr-contains :class "p-")])) + [element] (html/select element [[(html/but-node #{:br :hr}) (html/attr-contains :class "p-")]])) (defn- select-u - [element] (html/select element [(html/attr-contains :class "u-")])) + [element] (html/select element [[(html/but-node #{:br :hr}) (html/attr-contains :class "u-")]])) (defn- select-dt - [element] (html/select element [(html/attr-contains :class "dt-")])) + [element] (html/select element [[(html/but-node #{:br :hr}) (html/attr-contains :class "dt-")]])) (defn- select-e - [element] (html/select element [(html/attr-contains :class "e-")])) + [element] (html/select element [[(html/but-node #{:br :hr}) (html/attr-contains :class "e-")]])) (defn get-mf-properties "Parse children of a microformat, returning a map of properties"
M test/microformats/parser_expectations.cljtest/microformats/parser_expectations.clj
@@ -186,6 +186,16 @@ <a class=\"u-url\" href=\"http://example.com\">My Website</a>
<a class=\"u-url\" href=\"http://myblog.com\">My Blog</a> </div>")) +(expect {:items [{:type ["h-card"] + :properties {:name '("Example") + :tel '("01234567890")}}] + :rels {}} + (parse "<div class=\"h-card\"> +<p class=\"p-name\">Example</p> +<p class=\"p-tel\">01234567890</p> +<br class=\"p-tel\"> +</div>")) + (expect {:items [{:type ["h-adr"], :properties {:street-address '("665 3rd St."),