Skip to content

Commit

Permalink
Added atom.ss
Browse files Browse the repository at this point in the history
  • Loading branch information
zitterbewegung committed Nov 6, 2008
1 parent 6aceeb1 commit d6f4dd1
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions atom.ss
@@ -0,0 +1,37 @@
#lang scheme/base
(require "time.scm"
"util.scm"
"web-support.scm")
(provide atom-item
atom-inc)

(define (atom-inc feed)
`(link ((rel "alternate") (type "application/atom+xml") (href ,feed))))

(define (atom-wrapper feed-title
feed-subtitle
feed-url
url
author-name
author-email
body)
(list-response #:type #"text/xml"
(list (raw-str "<?xml version=\"1.0\" encoding=\"utf-8\"?>")
`(feed ((xmlns "http://www.w3.org/2005/Atom"))
(title ,feed-title)
(subtitle ,feed-subtitle)
(link ((href ,feed-url) (rel "self")))
(link ((href ,url)))
(updated ,(atom-time-str (current-seconds))" ")
(author (name ,author-name)
(email ,author-email))
(id ,(urn)) ,body))))

(define (atom-item item-title item-link item-summary item-content)
`(entry
(title ,item-title)
(link ((href ,item-link) (rel "self")))
(id ,(urn))
(updated ,(atom-time-str (current-seconds)))
(summary ,item-summary)
(content ,item-content)))

0 comments on commit d6f4dd1

Please sign in to comment.