Skip to content

Commit

Permalink
The title of each item in the RSS feed was being double-encoded,
Browse files Browse the repository at this point in the history
and also contained HTML, which it shouldn't have. The text is now
decoded before being passed to the RSS code, and <i> and <b>
tags stripped.

Change-Id: I3493b702eaf01933528f97477a7ed8c26c3c9075
  • Loading branch information
djm4 committed Jul 12, 2011
1 parent 0dafd44 commit 956fadc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions loader/alldivisions2rss.pl
Expand Up @@ -6,6 +6,7 @@
use PublicWhip::Parliaments;
use PublicWhip::SQLfragments;
use XML::RSS;
use HTML::Entities;

my $dbh = PublicWhip::DB::connect();
my $this_parliament=PublicWhip::Parliaments::getcurrent();
Expand Down Expand Up @@ -38,12 +39,15 @@
},
);

while (my $result= $results->fetchrow_hashref) {
$rss->add_item(
title => "Division: $result->{division_name}",
link => "http://www.publicwhip.org.uk/division.php?date=$result->{division_date}&number=$result->{division_number}&house=$result->{house}",
description=> "Vote on $result->{division_name} on $result->{division_date} ($result->{rebellions} rebellions; $result->{turnout} voters)"
);
while (my $result= $results->fetchrow_hashref) {
my $division_name = decode_entities($result->{'division_name'});
$division_name =~ s{< /? i >}{_}xmsg;
$division_name =~ s{< /? b >}{*}xmsg;
$rss->add_item(
title => "Division: $division_name",
link => "http://www.publicwhip.org.uk/division.php?date=$result->{division_date}&number=$result->{division_number}&house=$result->{house}",
description => "Vote on $result->{division_name} on $result->{division_date} ($result->{rebellions} rebellions; $result->{turnout} voters)"
);

}
print $rss->as_string;
Expand Down
16 changes: 10 additions & 6 deletions loader/interestingdivisions2rss.pl
Expand Up @@ -6,6 +6,7 @@
use PublicWhip::Parliaments;
use PublicWhip::SQLfragments;
use XML::RSS;
use HTML::Entities;

my $dbh = PublicWhip::DB::connect();
my $this_parliament=PublicWhip::Parliaments::getcurrent();
Expand Down Expand Up @@ -38,12 +39,15 @@
},
);

while (my $result= $results->fetchrow_hashref) {
$rss->add_item(
title => "$result->{rebellions} Rebellions in $result->{division_name}",
link => "http://www.publicwhip.org.uk/division.php?date=$result->{division_date}&number=$result->{division_number}&house=$result->{house}",
description=> "$result->{rebellions} rebellions ($result->{turnout} voters) in vote on $result->{division_name} on $result->{division_date}"
);
while (my $result= $results->fetchrow_hashref) {
my $division_name = decode_entities($result->{'division_name'});
$division_name =~ s{< /? i >}{_}xmsg;
$division_name =~ s{< /? b >}{*}xmsg;
$rss->add_item(
title => "$result->{rebellions} Rebellions in $division_name",
link => "http://www.publicwhip.org.uk/division.php?date=$result->{division_date}&number=$result->{division_number}&house=$result->{house}",
description => "$result->{rebellions} rebellions ($result->{turnout} voters) in vote on $result->{division_name} on $result->{division_date}"
);

}
print $rss->as_string;
Expand Down

0 comments on commit 956fadc

Please sign in to comment.