about summary refs log tree commit diff stats
path: root/src/microformats
diff options
context:
space:
mode:
authorAlan Pearce2014-09-22 20:36:26 +0100
committerAlan Pearce2014-09-22 20:36:26 +0100
commit385ef0db111ad842be4817171f9a19276d312fb5 (patch)
tree63b3942303395035c53b8a0021cb9b56a0bed727 /src/microformats
parent0fe95fe03334c62c2c36f0e3a1d2be167fc4a506 (diff)
downloadmicroformats-385ef0db111ad842be4817171f9a19276d312fb5.tar.lz
microformats-385ef0db111ad842be4817171f9a19276d312fb5.tar.zst
microformats-385ef0db111ad842be4817171f9a19276d312fb5.zip
Trim extra spaces from HTML content
Diffstat (limited to 'src/microformats')
-rw-r--r--src/microformats/parser.clj9
1 files changed, 9 insertions, 0 deletions
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]