Plagger/Plugin/Filter/BloglinesContentNormalize.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 CC 2 SCAR 12.8
CC
2
Cov
0%
filter
6.0
register
2.0
BEGIN
2.0
CRAP 3.6
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 $c += $body =~ s!"/>!" />!g;
22 if ($c) {
23 $context->log(info => "Stripped Bloglines extra attributes on " . $args->{entry}->link);
24 $args->{entry}->body($body);
25 }
26 }
27  
28 1;
29  
30 __END__