From 385ef0db111ad842be4817171f9a19276d312fb5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 Sep 2014 20:36:26 +0100 Subject: Trim extra spaces from HTML content --- src/microformats/parser.clj | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/microformats') diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index eade3dc..cd57693 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -101,6 +101,15 @@ % (apply str (persistent! (html/emit-tag % (transient []))))) el)) +(defn- node-to-text + "Turn a node into a text string" + [content] + (->> content + html/texts + (map #(str/replace % #"\s+" " ")) + (apply str) + str/trim)) + (defn get-e-value "Get the e-x propery value of an element" [el] -- cgit 1.4.1