diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d627f3..02032f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ## Fixed ## Changed +- Normalize spacing in style attr with multiple properties. + Where before the generated style attr might have "\n" or " ", + these are all now a simple " ", e.g. in-between multiple CSS properties. # 0.9.48 (2024-06-18 / e43362c) diff --git a/src/lambdaisland/hiccup.clj b/src/lambdaisland/hiccup.clj index 5c36408..4d4187d 100644 --- a/src/lambdaisland/hiccup.clj +++ b/src/lambdaisland/hiccup.clj @@ -120,6 +120,7 @@ (update-in [:attrs "style"] (fn [style] (-> (gc/compile-css [:& style]) (str/replace #"^\s*\{|\}\s*$" "") + (str/replace #"[ \n]+" " ") str/trim))) (sequential? (get-in node [:attrs "class"])) (update-in [:attrs "class"] #(str/join " " %)) diff --git a/test/lambdaisland/hiccup_test.clj b/test/lambdaisland/hiccup_test.clj index 2abbaf1..f7ad013 100644 --- a/test/lambdaisland/hiccup_test.clj +++ b/test/lambdaisland/hiccup_test.clj @@ -1,4 +1,3 @@ - (ns lambdaisland.hiccup-test (:require [clojure.test :refer [deftest testing is]] [lambdaisland.hiccup :as hiccup])) @@ -19,8 +18,9 @@ (is (= (hiccup/render [:div [:p]] {:doctype? false}) "
hello
")))