! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel sequences fry combinators syndication http.server.responses http.server.redirection furnace.actions furnace.utilities ; IN: furnace.syndication GENERIC: feed-entry-title ( object -- string ) GENERIC: feed-entry-date ( object -- timestamp ) GENERIC: feed-entry-url ( object -- url ) GENERIC: feed-entry-description ( object -- description ) M: object feed-entry-description drop f ; GENERIC: >entry ( object -- entry ) M: entry >entry ; M: object >entry swap { [ feed-entry-title >>title ] [ feed-entry-date >>date ] [ feed-entry-url >>url ] [ feed-entry-description >>description ] } cleave ; : process-entries ( seq -- seq' ) 20 short head-slice [ >entry clone [ adjust-url ] change-url ] map ; : ( body -- response ) feed>xml "application/atom+xml" ; TUPLE: feed-action < action title url entries ; : ( -- action ) feed-action new-action dup '[ feed new _ [ title>> call >>title ] [ url>> call adjust-url >>url ] [ entries>> call process-entries >>entries ] tri ] >>display ;