Heads postings on front page
"dvanhorn" <[email protected]> Thu, 15 Jan 2004 17:22:48 -0500
| Newsgroups | gmane.org.ballistichelmet.devel |
|---|---|
| Message-ID | <[email protected]> |
5 minutes of coding:
#! /home/bh/local/bin/mzscheme -r
(require (lib "xml.ss" "xml")
(lib "url.ss" "net")
(lib "match.ss"))
(define url (string->url "http://ballistichelmet.org/rss/heads.rss"))
(define (get-rss)
(xml->xexpr
((eliminate-whitespace '(rss channel item) (lambda (x) x))
(document-element (call/input-url url get-pure-port read-xml)))))
(match (get-rss)
(('rss _
('channel _
('title _ _)
('link _ _)
('description _ _)
. items))
(for-each
(match-lambda
(('item _
('title _ title)
('link _ link)
('description _ . strings))
(printf
"<div class=\"headline\">
<h4 class=\"news\"><a href=\"~a\">~a</a></h4>
<p class=\"date\">no date</p>
</div>
<p class=\"comment\">~a</p></div>"
link title (apply string-append strings))))
items)))