From bd5a901a5081d01df16ab3a750fdfa403391b3d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 Oct 2014 09:14:30 +0100 Subject: Add helper function to get base URL --- src/microformats/parser.clj | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index ba07fcf..e3a244e 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -65,6 +65,15 @@ (apply str) str/trim)) +(defn get-base-url + "Find the base-url of a document." + [document] + (-> document + (html/select [:head :> [:base (html/attr? :href)]]) + first + :attrs + :href)) + (defn get-value-class "Get the value class of elements" [elements] -- cgit 1.4.1