diff --git a/lib/MetaCPAN/Web/Model/API/Changes.pm b/lib/MetaCPAN/Web/Model/API/Changes.pm
index 4117cc8b46..ad7246dff2 100644
--- a/lib/MetaCPAN/Web/Model/API/Changes.pm
+++ b/lib/MetaCPAN/Web/Model/API/Changes.pm
@@ -96,14 +96,17 @@ sub _rt_cpan {
# Some other cases
$line =~ s{\b(bug\s+\#)(\d+)\b}{$u$2">$1$2}gxi;
+ # Subject tag style
+ $line =~ s{(\[?rt\.cpan\.org\s+\#(\d+)\]?)}{$u$2">$1}gxi;
+
return $line;
}
sub _gh {
my ($self, $line, $bt) = @_;
$bt =~ s|/$||;
- $line =~ s{(GH[-:]?)(\d+)\b}{$1$2}gxi;
- $line =~ s{((?:GH|)[#])(\d+)\b}{$1$2}gxi;
+ $line =~ s{((?:GH|PR)[-:]?)(\d+)\b}{$1$2}gxi;
+ $line =~ s{((?:GH|PR|)[#])(\d+)\b}{$1$2}gxi;
return $line;
}
1;
diff --git a/t/model/changes.t b/t/model/changes.t
index ec85a55f8d..0130f0e409 100644
--- a/t/model/changes.t
+++ b/t/model/changes.t
@@ -24,10 +24,12 @@ subtest "RT ticket linking" => sub {
'id=87550">rt87550',
'Fix bug #87801 where excluded tags were ANDed instead of ORed. Stefan Corneliu Petrea.' =>
'id=87801">bug #87801',
+ 'Blah blah [rt.cpan.org #231] fixed' => 'id=231">[rt.cpan.org #231]',
+ 'Blah blah rt.cpan.org #231 fixed' => 'id=231">rt.cpan.org #231',
);
while (my ($in, $out) = each %rt_tests) {
- like(Changes->_rt_cpan($in), qr/$out/, "$in found");
+ like(Changes->_rt_cpan($in), qr/\Q$out\E/, "$in found");
}
};
@@ -40,9 +42,12 @@ subtest "GH issue linking" => sub {
'Fixed GH:1013' => 'issues/1013">GH:1013',
'Fixed GH #1013' => 'issues/1013">#1013',
'Add HTTP logger (gh-16; thanks djzort!)' => 'issues/16">gh-16',
+ 'Merged PR#1013 -- thanks' => 'issues/1013">PR#1013',
+ 'Merged PR:1013 -- thanks' => 'issues/1013">PR:1013',
+ 'Merged PR-1013 -- thanks' => 'issues/1013">PR-1013',
);
while (my ($in, $out) = each %gh_tests) {
- like(Changes->_gh($in, $u), qr/$out/, "$in found");
+ like(Changes->_gh($in, $u), qr/\Q$out\E/, "$in found");
}
my @no_links_tests = (
'I wash my hands of this library forever -- rjbs, 2013-10-15'