From e438fe2a80ae19d158678b284eb3f491bcdcdd65 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 29 Sep 2008 23:36:40 -0500 Subject: [PATCH] Handle Atom feeds with multiple entry links --- basis/syndication/syndication.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/syndication/syndication.factor b/basis/syndication/syndication.factor index ca7511f1af..aca09b939c 100644 --- a/basis/syndication/syndication.factor +++ b/basis/syndication/syndication.factor @@ -69,11 +69,15 @@ TUPLE: entry title url description date ; [ "item" tags-named [ rss2.0-entry ] map set-entries ] tri ; +: atom-entry-link ( tag -- url/f ) + "link" tags-named [ "rel" swap at "alternate" = ] find nip + dup [ "href" swap at >url ] when ; + : atom1.0-entry ( tag -- entry ) entry new swap { [ "title" tag-named children>string >>title ] - [ "link" tag-named "href" swap at >url >>url ] + [ atom-entry-link >>url ] [ { "content" "summary" } any-tag-named dup children>> [ string? not ] contains?