Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter::Regexp now works on each entry as intended #8

Merged
merged 1 commit into from Oct 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Plagger/Plugin/Filter/Regexp.pm
Expand Up @@ -17,7 +17,7 @@ sub filter {
my($self, $body) = @_;

local $_ = $body;
my $regexp = decode_utf8($self->conf->{regexp}, Encode::FB_CROAK);
my $regexp = decode_utf8($self->conf->{regexp}, Encode::FB_CROAK | Encode::LEAVE_SRC);
my $count = eval $regexp;

if ($@) {
Expand Down
5 changes: 4 additions & 1 deletion t/plugins/Filter-Regexp/base.t
Expand Up @@ -15,9 +15,12 @@ plugins:
entry:
- title: bar
body: Plagger
- title: baz
body: Plagger, she said.
- module: Filter::Regexp
config:
regexp: s/Plagger/Plagger is a pluggable aggregator/g
text_only: 1
--- expected
is $context->update->feeds->[0]->entries->[0]->body, "Plagger is a pluggable aggregator"
is $context->update->feeds->[0]->entries->[0]->body, "Plagger is a pluggable aggregator";
is $context->update->feeds->[0]->entries->[1]->body, "Plagger is a pluggable aggregator, she said.";