1 ! Copyright (C) 2008, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators furnace.actions furnace.utilities
4 http.server.responses io.encodings.utf8 kernel sequences
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>
39 "UTF-8" >>content-charset
40 utf8 >>content-encoding ;
42 TUPLE: feed-action < action title url entries ;
44 : <feed-action> ( -- action )
45 feed-action new-action
49 [ title>> call >>title ]
50 [ url>> call adjust-url >>url ]
51 [ entries>> call process-entries >>entries ]