Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (22 sloc) 1.33 KB
(ns rhinowiki.atom
(:use rhinowiki.utils)
(:require [ :as xml]))
(def df-atom-rfc3339 (java.text.SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ssXXX"))
(defn- atom-article-entry [ blog article ]
(xml/element "entry" {}
(xml/element "title" {} (:title article))
(xml/element "id" {} (str "urn:uuid:" (:id article)))
(xml/element "updated" {} (.format df-atom-rfc3339 (:date article)))
(xml/element "author" {} (xml/element "name" {} (:blog-author blog)))
(xml/element "link" {:href (:permalink article)})
(xml/element "content" {:type "html"} (xml/cdata (:content-html article)))))
(defn atom-blog-feed [ blog articles ]
(xml/element "feed" {:xmlns ""}
(xml/element "title" {} (:blog-title blog))
(xml/element "link" {:href (:base-url blog)})
(xml/element "link" {:rel "self" :href (str (:base-url blog) "/feed/atom")} )
(xml/element "updated" {} (.format df-atom-rfc3339 (or (:date (first articles))
(xml/element "id" {} (str "urn:uuid:" (:blog-id blog)))
(map #(atom-article-entry blog %) articles))))
You can’t perform that action at this time.