Changeset 732
- Timestamp:
- 05/13/06 07:13:25
- Files:
-
- trunk/plagger/lib/Plagger/Entry.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Publish/Feed.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Entry.pm
r719 r732 85 85 } 86 86 87 sub has_enclosure { 88 my $self = shift; 89 scalar @{$self->{enclosures}} > 0; 90 } 91 87 92 1; 88 93 trunk/plagger/lib/Plagger/Plugin/Publish/Feed.pm
r355 r732 58 58 $entry->issued($e->date) if $e->date; 59 59 $entry->author($e->author); 60 61 # RSS 2.0 by spec doesn't allow multiple enclosures 62 if ($e->has_enclosure) { 63 my @enclosures = $feed_format eq 'RSS' ? ($e->enclosures->[0]) : $e->enclosures; 64 for my $enclosure (@enclosures) { 65 $entry->add_enclosure({ 66 url => $enclosure->url, 67 length => $enclosure->length, 68 type => $enclosure->type, 69 }); 70 } 71 } 72 60 73 $feed->add_entry($entry); 61 74 } … … 100 113 } 101 114 115 # XXX okay, this is a hack until XML::Feed is updated 116 *XML::Feed::Entry::Atom::add_enclosure = sub { 117 my($entry, $enclosure) = @_; 118 my $link = XML::Atom::Link->new; 119 $link->rel('enclosure'); 120 $link->type($enclosure->{type}); 121 $link->href($enclosure->{url}); 122 $link->length($enclosure->{length}); 123 $entry->{entry}->add_link($link); 124 }; 125 126 *XML::Feed::Entry::RSS::add_enclosure = sub { 127 my($entry, $enclosure) = @_; 128 $entry->{entry}->{enclosure} = { 129 url => $enclosure->{url}, 130 type => $enclosure->{type}, 131 length => $enclosure->{length}, 132 }; 133 }; 134 135 102 136 1; 103 137 … … 157 191 Yoshiki KURIHARA 158 192 193 Tatsuhiko Miyagawa 194 195 Gosuke Miyashita 196 159 197 =head1 SEE ALSO 160 198
