1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel sequences fry combinators syndication
4 http.server.responses http.server.redirection furnace.actions
6 IN: furnace.syndication
8 GENERIC: feed-entry-title ( object -- string )
10 GENERIC: feed-entry-date ( object -- timestamp )
12 GENERIC: feed-entry-url ( object -- url )
14 GENERIC: feed-entry-description ( object -- description )
16 M: object feed-entry-description drop f ;
18 GENERIC: >entry ( object -- entry )
25 [ feed-entry-title >>title ]
26 [ feed-entry-date >>date ]
27 [ feed-entry-url >>url ]
28 [ feed-entry-description >>description ]
31 : process-entries ( seq -- seq' )
34 [ adjust-url ] change-url
37 : <feed-content> ( body -- response )
38 feed>xml "application/atom+xml" <content> ;
40 TUPLE: feed-action < action title url entries ;
42 : <feed-action> ( -- action )
43 feed-action new-action
47 [ title>> call >>title ]
48 [ url>> call adjust-url >>url ]
49 [ entries>> call process-entries >>entries ]