aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm39
1 files changed, 2 insertions, 37 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index 41444fdd4..8d3d53d0d 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -98,16 +98,7 @@ Add some links to some text (and thus HTML-escapes the other text).
sub add_links {
my $text = shift;
- $text = FixMyStreet::Template::conditional_escape($text);
- $text =~ s/\r//g;
- $text =~ s{(?<!["'])(https?://)([^\s]+)}{"<a href=\"$1$2\">$1" . _space_slash($2) . '</a>'}ge;
- return FixMyStreet::Template::SafeString->new($text);
-}
-
-sub _space_slash {
- my $t = shift;
- $t =~ s{/(?!$)}{/ }g;
- return $t;
+ return FixMyStreet::Template::add_links($text);
}
=head2 staff_html_markup_factory
@@ -126,36 +117,10 @@ sub staff_html_markup_factory {
return sub {
my $text = shift;
- return _staff_html_markup($text, $staff);
+ return FixMyStreet::Template::_staff_html_markup($text, $staff);
}
}
-sub _staff_html_markup {
- my ( $text, $staff ) = @_;
- unless ($staff) {
- return FixMyStreet::Template::html_paragraph(add_links($text));
- }
-
- $text = FixMyStreet::Template::sanitize($text);
-
- # Apply Markdown-style italics
- $text =~ s{\*(\S.*?\S)\*}{<i>$1</i>};
-
- # Mark safe so add_links doesn't escape everything.
- $text = FixMyStreet::Template::SafeString->new($text);
-
- $text = add_links($text);
-
- # If the update already has block-level elements then don't wrap
- # individual lines in <p> elements, as we assume the user knows what
- # they're doing.
- unless ($text =~ /<(p|ol|ul)>/) {
- $text = FixMyStreet::Template::html_paragraph($text);
- }
-
- return $text;
-}
-
=head2 escape_js
Used to escape strings that are going to be put inside JavaScript.