X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/846fb637af846e0754db9720c864e653621824a9..109d256aa18940c16559e71abedcae98685838c8:/IkiWiki/Plugin/aggregate.pm diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 8f0870e2e..2069a352e 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -535,6 +535,14 @@ sub aggregate (@) { next; } my $content=$res->content; + + # This is a hack to support the media:content extension + # to RSS. XML::Feed does not support it, but it's the same + # as an enclosure, so converting it to that tag will let it + # parse. + $content=~s/parse(\$content)}; if ($@) { # One common cause of XML::Feed crashing is a feed @@ -590,6 +598,10 @@ sub aggregate (@) { title => defined $entry->title ? decode_entities($entry->title) : "untitled", author => defined $entry->author ? decode_entities($entry->author) : "", link => $entry->link, + enclosureurl => defined $entry->enclosure ? $entry->enclosure->url : "", + enclosureimage => (defined $entry->enclosure && $entry->enclosure->type =~ m/image\//) ? "1" : "", + enclosureaudio => (defined $entry->enclosure && $entry->enclosure->type =~ m/audio\//) ? "1" : "", + enclosurevideo => (defined $entry->enclosure && $entry->enclosure->type =~ m/video\//) ? "1" : "", content => (defined $c && defined $c->body) ? $c->body : "", guid => defined $entry->id ? $entry->id : time."_".$feed->{name}, ctime => $entry->issued ? ($entry->issued->epoch || time) : time, @@ -700,6 +712,14 @@ sub write_page ($$$$$) { if defined $params{copyright} && length $params{copyright}; $template->param(permalink => IkiWiki::urlabs($params{link}, $feed->{feedurl})) if defined $params{link}; + $template->param(enclosureurl => $params{enclosureurl}) + if defined $params{enclosureurl} && length $params{enclosureurl}; + $template->param(enclosureimage => $params{enclosureimage}) + if defined $params{enclosureimage} && length $params{enclosureimage}; + $template->param(enclosureaudio => $params{enclosureaudio}) + if defined $params{enclosureaudio} && length $params{enclosureaudio}; + $template->param(enclosurevideo => $params{enclosurevideo}) + if defined $params{enclosurevideo} && length $params{enclosurevideo}; if (ref $feed->{tags}) { $template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]); }