aggregate: Support atom feeds with only a summary element, and no content elements.
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 17 Sep 2008 19:56:58 +0000 (15:56 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 17 Sep 2008 19:56:58 +0000 (15:56 -0400)
IkiWiki/Plugin/aggregate.pm
debian/changelog
doc/plugins/aggregate/discussion.mdwn

index 2f20ad2e56411d1f4b0463c3781258db1e338500..c1421f24612863014a5a8f53ecb3c4bb1aab708f 100644 (file)
@@ -520,12 +520,18 @@ sub aggregate (@) { #{{{
                }
 
                foreach my $entry ($f->entries) {
+                       my $content=$content=$entry->content;
+                       # atom feeds may have no content, only a summary
+                       if (! defined $content) {
+                               $content=$entry->summary;
+                       }
+
                        add_page(
                                feed => $feed,
                                copyright => $f->copyright,
                                title => defined $entry->title ? decode_entities($entry->title) : "untitled",
                                link => $entry->link,
-                               content => defined $entry->content->body ? $entry->content->body : "",
+                               content => defined $content ? $content->body : "",
                                guid => defined $entry->id ? $entry->id : time."_".$feed->{name},
                                ctime => $entry->issued ? ($entry->issued->epoch || time) : time,
                        );
index b05e8390ba0201de5dd3d0c83a22ec6ed1f15c74..5ad864c13e7b3c082f5ab1b64a788f8b57c6b075 100644 (file)
@@ -3,6 +3,8 @@ ikiwiki (2.65) UNRELEASED; urgency=low
   * aggregate: Allow expirecount to work on the first pass. (expireage still
     needs to wait for the pages to be rendered though)
   * editdiff: Broken since 2.62 due to wrong syntax, now fixed.
+  * aggregate: Support atom feeds with only a summary element, and no content
+    elements.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 17 Sep 2008 14:26:56 -0400
 
index 62db5c816e25e6ec31f289a90ceda24f4b2b7ec3..2ecdea2e30c7a7560aa794e7378f98a68c941986 100644 (file)
@@ -40,3 +40,7 @@ Two things aren't working as I'd expect:
 > parsers are more lenient. --[[Joey]]
 
 >> Thanks for the quick response (and the `expirecount` fix); I've forwarded it to David so he can fix his feed. Nathan's Atom feed validates -- it's generated by the same CMS as mine -- so I'm still at a loss on that one. --[[schmonz]]
+
+>>> Nathan's feed contains only summary elements, with no content elements.
+>>> This is legal according to the Atom spec, so I've fixed ikiwiki to use
+>>> the summary if no content is available. --[[Joey]]