]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/syndication/syndication.factor
fix link when extracting the feed address
[factor.git] / basis / syndication / syndication.factor
index 0cc124c088dbb0e2dc812b531e019f7a063b23c6..407e09aab11dbd68c50ae0b6a10c087ae414b55e 100644 (file)
@@ -65,15 +65,14 @@ 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" attr { f "alternate" } member? ] find nip
-    dup [ "href" attr >url ] when ;
+: atom-link ( tag -- url/f )
+    "link" "alternate" "rel" tag-named-with-attr
+    [ "href" attr >url ] [ f ] if* ;
 
 : atom1.0-entry ( tag -- entry )
     <entry> swap {
         [ "title" tag-named children>string >>title ]
-        [ atom-entry-link >>url ]
+        [ atom-link >>url ]
         [
             { "content" "summary" } any-tag-named
             dup children>> [ string? not ] any?
@@ -90,7 +89,7 @@ TUPLE: entry title url description date ;
 : atom1.0 ( xml -- feed )
     <feed> swap
     [ "title" tag-named children>string >>title ]
-    [ "link" tag-named "href" attr >url >>url ]
+    [ atom-link >>url ]
     [ "entry" tags-named [ atom1.0-entry ] map set-entries ]
     tri ;