From: Joey Hess Date: Wed, 17 Sep 2008 19:56:58 +0000 (-0400) Subject: aggregate: Support atom feeds with only a summary element, and no content elements. X-Git-Tag: 2.65~97 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1cb4154bc8131ed317802ec9d39490237cd64462;p=ikiwiki.git aggregate: Support atom feeds with only a summary element, and no content elements. --- diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 2f20ad2e5..c1421f246 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -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, ); diff --git a/debian/changelog b/debian/changelog index b05e8390b..5ad864c13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Wed, 17 Sep 2008 14:26:56 -0400 diff --git a/doc/plugins/aggregate/discussion.mdwn b/doc/plugins/aggregate/discussion.mdwn index 62db5c816..2ecdea2e3 100644 --- a/doc/plugins/aggregate/discussion.mdwn +++ b/doc/plugins/aggregate/discussion.mdwn @@ -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]]