root/trunk/plagger/lib/Plagger/Plugin/Filter/BloglinesContentNormalize.pm

Revision 1661 (checked in by miyagawa, 14 years ago)

StripRSSAd: deal with Bloglines content body update. Filter::BloglinesContentNormalize?: strip 

Line 
1 package Plagger::Plugin::Filter::BloglinesContentNormalize;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 our $Pattern = qr! target=_blank class=blines[23] title="Link (?:outside of|to another page in) this blog"!;
6
7 sub register {
8     my($self, $context) = @_;
9     $context->register_hook(
10         $self,
11         'update.entry.fixup' => \&filter,
12     );
13 }
14
15 sub filter {
16     my($self, $context, $args) = @_;
17
18     my $body = $args->{entry}->body;
19     my $c  = $body =~ s!$Pattern!!g;
20        $c += $body =~ s!
!!g;
21     if ($c) {
22         $context->log(info => "Stripped Bloglines extra attributes on " . $args->{entry}->link);
23         $args->{entry}->body($body);
24     }
25 }
26
27 1;
28
29 __END__
30
31 =head1 NAME
32
33 Plagger::Plugin::Filter::BloglinesContentNormalize - Strip extra attributes in Bloglines body
34
35 =head1 SYNOPSIS
36
37   - module: Filter::BloglinesContentNormalize
38
39 =head1 DESCRIPTION
40
41 This plugin strips extra attributes contained in Bloglines entry feed, e.g.
42
43   target=_blank class=blines2 title="Link to another page in this blog"
44   target=_blank class=blines3 title="Link outside of this blog"
45
46 This plugin is autoloaded via Filter::StripRSSAd plugin.
47
48 =head1 AUTHOR
49
50 Tatsuhiko Miyagawa
51
52 =head1 SEE ALSO
53
54 L<Plagger>, L<Plagger::Plugin::Filter::StripRSSAd>, L<http://www.bloglines.com/>
55
56 =cut
Note: See TracBrowser for help on using the browser.