diff --git a/extra/rss/rss.factor b/extra/rss/rss.factor index 99360e5509..017160e7e1 100644 --- a/extra/rss/rss.factor +++ b/extra/rss/rss.factor @@ -4,7 +4,8 @@ IN: rss USING: xml.utilities kernel assocs xml.generator strings sequences xml.data xml.writer io.streams.string combinators xml xml.entities io.files io - http.client namespaces xml.generator hashtables ; + http.client namespaces xml.generator hashtables + calendar.format accessors continuations ; : ?children>string ( tag/f -- string/f ) [ children>string ] [ f ] if* ; @@ -25,7 +26,7 @@ C: entry [ "link" tag-named children>string ] keep [ "description" tag-named children>string ] keep f "date" "http://purl.org/dc/elements/1.1/" - tag-named ?children>string + tag-named ?children>string rfc3339>timestamp ; : rss1.0 ( xml -- feed ) @@ -41,7 +42,7 @@ C: entry [ "link" tag-named ] keep [ "guid" tag-named dupd ? children>string ] keep [ "description" tag-named children>string ] keep - "pubDate" tag-named children>string ; + "pubDate" tag-named children>string rfc3339>timestamp ; : rss2.0 ( xml -- feed ) "channel" tag-named @@ -59,7 +60,7 @@ C: entry [ children>string ] if ] keep { "published" "updated" "issued" "modified" } any-tag-named - children>string ; + children>string rfc3339>timestamp ; : atom1.0 ( xml -- feed ) [ "title" tag-named children>string ] keep @@ -78,10 +79,10 @@ C: entry : download-feed ( url -- feed ) #! Retrieve an news syndication file, return as a feed tuple. - http-get-stream rot success? [ - nip read-feed + http-get-stream swap code>> success? [ + read-feed ] [ - 2drop "Error retrieving newsfeed file" throw + dispose "Error retrieving newsfeed file" throw ] if ; ! Atom generation @@ -95,7 +96,7 @@ C: entry "entry" [ dup entry-title "title" { { "type" "html" } } simple-tag*, "link" over entry-link "href" associate contained*, - dup entry-pub-date "published" simple-tag, + dup entry-pub-date timestamp>rfc3339 "published" simple-tag, entry-description [ "content" { { "type" "html" } } simple-tag*, ] when* ] tag, ;