aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-12 16:24:20 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-08-12 17:40:43 +0100
commit2c30a2a5978f16ef8fda06b20c10f50a628fc787 (patch)
tree5b81b2c46e7134f84d4b4cf3cef638a6b43ca8e5 /perllib/FixMyStreet/App
parent79598ca4e40ada5ff464f6589119cbbe17f93ef5 (diff)
Switch add_links template function to filter.
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index d43d3af7e..63f21ff91 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -18,9 +18,10 @@ __PACKAGE__->config(
render_die => 1,
expose_methods => [
'loc', 'nget', 'tprintf', 'prettify_dt',
- 'add_links', 'version', 'decode',
+ 'version', 'decode',
],
FILTERS => {
+ add_links => \&add_links,
escape_js => \&escape_js,
html => \&html_filter,
},
@@ -105,15 +106,14 @@ sub prettify_dt {
=head2 add_links
- [% add_links( text ) | html_para %]
+ [% text | add_links | html_para %]
Add some links to some text (and thus HTML-escapes the other text.
=cut
sub add_links {
- my ( $self, $c, $text ) = @_;
-
+ my $text = shift;
$text =~ s/\r//g;
$text = ent($text);
$text =~ s{(https?://)([^\s]+)}{"<a href='$1$2'>$1" . _space_slash($2) . '</a>'}ge;