From e81f922f1522030ac801c9f27b8732f0e81d2e08 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Oct 2014 10:30:09 +0100 Subject: Fix whitespace collapsing with multiple elements --- src/microformats/parser.clj | 2 +- test/microformats/parser_expectations.clj | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index 4f63d55..8ae5665 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -73,8 +73,8 @@ [content] (->> content html/texts - (map #(str/replace % #"\s+" " ")) (apply str) + (#(str/replace % #"\s+" " ")) str/trim)) (defn get-base-url diff --git a/test/microformats/parser_expectations.clj b/test/microformats/parser_expectations.clj index 5486898..9c9da10 100644 --- a/test/microformats/parser_expectations.clj +++ b/test/microformats/parser_expectations.clj @@ -188,6 +188,9 @@ (expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}} (parse "
Example User
")) +(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}} + (parse "Example User
")) + (expect {:items '({:type ("h-card") :properties {:name ("Example User") :url ("http://example.com")}}) :rels {}} (parse "Example User")) -- cgit 1.4.1