aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-11 12:27:20 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-11 12:27:20 +0000
commit260777cec28b2b29bfc47389d7014ce367a62811 (patch)
tree27d40866685e6f3be2e9dabd843afed4d4c72e54 /perllib/FixMyStreet/App/View/Web.pm
parent310938d518367c15dbd0188f863e6ed841f53fb9 (diff)
Insert spaces into printed links.
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index 28c159cf2..8d3775ddc 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -121,11 +121,16 @@ sub add_links {
$text =~ s/\r//g;
$text = ent($text);
- $text =~ s{(https?://[^\s]+)}{<a href="$1">$1</a>}g;
- #$text =~ s{">(.*?)<}{">$1<}ge;
+ $text =~ s{(https?://)([^\s]+)}{"<a href='$1$2'>$1" . _space_slash($2) . '</a>'}ge;
return $text;
}
+sub _space_slash {
+ my $t = shift;
+ $t =~ s{/(?!$)}{/ }g;
+ return $t;
+}
+
=head2 escape_js
Used to escape strings that are going to be put inside JavaScript.