]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/syndication/syndication.factor
syndication: Fix atom parsing.
[factor.git] / basis / syndication / syndication.factor
index 0961e50675ecbcfceb6167dc4359d1a0317cad15..36e26a15c4238fa26ec16ef804a6a59252a27a41 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2006 Chris Double, Daniel Ehrenberg.
 ! Portions copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: xml.traversal kernel assocs math.order strings sequences
-xml.data xml.writer io.streams.string combinators xml
-xml.entities.html io.files io http.client namespaces make
-xml.syntax hashtables calendar.format calendar.parser accessors
-continuations urls present byte-arrays ;
+USING: accessors byte-arrays calendar.format calendar.parser
+combinators combinators.short-circuit continuations http.client
+kernel present sequences strings urls xml xml.data
+xml.entities.html xml.syntax xml.traversal xml.writer ;
 IN: syndication
 
 : any-tag-named ( tag names -- tag-inside )
@@ -65,8 +64,14 @@ TUPLE: entry title url description date ;
     [ "item" tags-named [ rss2.0-entry ] map set-entries ]
     tri ;
 
+ERROR: invalid-atom-link ;
+
 : atom-link ( tag -- url/f )
-    "link" "alternate" "rel" tag-named-with-attr
+    {
+        [ "link" "alternate" "rel" tag-named-with-attr ]
+        [ "link" "self" "rel" tag-named-with-attr ]
+        [ "link" tag-named ]
+    } 1||
     [ "href" attr >url ] [ f ] if* ;
 
 : atom1.0-entry ( tag -- entry )