diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2011-05-05 08:14:39 +0200 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-05-06 20:11:48 +0100 |
commit | 046017fdceef7302e9c4707740d98082c496209c (patch) | |
tree | f392eaad82b62a6f447c86809f9771bb71c9dc28 | |
parent | 7b770eb23a30359324d2da09b91a12e3be497844 (diff) |
Change where URLs are converted to links, to avoid including the trailing </p> in the link when the URL is last in the text.
-rw-r--r-- | perllib/Page.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 382f65797..a52f455b4 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -602,9 +602,10 @@ sub display_problem_detail($) { (my $detail = $problem->{detail}) =~ s/\r//g; my $out = ''; foreach (split /\n{2,}/, $detail) { - $out .= '<p>' . ent($_) . '</p>'; + my $enttext = $_; + $enttext =~ s%(https?://[^\s]+)%<a href="$1">$1</a>%g; + $out .= '<p>' . $enttext . '</p>'; } - $out =~ s%(https?://[^\s]+)%<a href="$1">$1</a>%g; return $out; } @@ -670,7 +671,9 @@ sub display_problem_updates($$) { my $text = $row->{text}; $text =~ s/\r//g; foreach (split /\n{2,}/, $text) { - $out .= '<p>' . ent($_) . '</p>'; + my $enttext = ent($_); + $enttext =~ s%(https?://[^\s]+)%<a href="$1">$1</a>%g; + $out .= '<p>' . $enttext . '</p>'; } my $cobrand = get_cobrand($q); my $display_photos = Cobrand::allow_photo_display($cobrand); @@ -683,7 +686,6 @@ sub display_problem_updates($$) { } $out .= '</div>'; } - $out =~ s%(https?://[^\s]+)%<a href="$1">$1</a>%g; return $out; } |