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

Revision 604 (checked in by miyagawa, 15 years ago)

rename plugin

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     if (my $c = $body =~ s!$Pattern!!g) {
20         $context->log(info => "Stripped Bloglines extra attributes on " . $args->{entry}->link);
21         $args->{entry}->body($body);
22     }
23 }
24
25 1;
26
27 __END__
28
29 =head1 NAME
30
31 Plagger::Plugin::Filter::BloglinesContentNormalize - Strip extra attributes in Bloglines body
32
33 =head1 SYNOPSIS
34
35   - module: Filter::BloglinesContentNormalize
36
37 =head1 DESCRIPTION
38
39 This plugin strips extra attributes contained in Bloglines entry feed, e.g.
40
41   target=_blank class=blines2 title="Link to another page in this blog"
42   target=_blank class=blines3 title="Link outside of this blog"
43
44 This plugin is autoloaded via Filter::StripRSSAd plugin.
45
46 =head1 AUTHOR
47
48 Tatsuhiko Miyagawa
49
50 =head1 SEE ALSO
51
52 L<Plagger>, L<Plagger::Plugin::Filter::StripRSSAd>, L<http://www.bloglines.com/>
53
54 =cut
Note: See TracBrowser for help on using the browser.