diff options
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 5e38fc797..41444fdd4 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -126,29 +126,34 @@ sub staff_html_markup_factory { return sub { my $text = shift; - unless ($staff) { - return FixMyStreet::Template::html_paragraph(add_links($text)); - } + return _staff_html_markup($text, $staff); + } +} - $text = FixMyStreet::Template::sanitize($text); +sub _staff_html_markup { + my ( $text, $staff ) = @_; + unless ($staff) { + return FixMyStreet::Template::html_paragraph(add_links($text)); + } - # Apply Markdown-style italics - $text =~ s{\*(\S.*?\S)\*}{<i>$1</i>}; + $text = FixMyStreet::Template::sanitize($text); - # Mark safe so add_links doesn't escape everything. - $text = FixMyStreet::Template::SafeString->new($text); + # Apply Markdown-style italics + $text =~ s{\*(\S.*?\S)\*}{<i>$1</i>}; - $text = add_links($text); + # Mark safe so add_links doesn't escape everything. + $text = FixMyStreet::Template::SafeString->new($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); - } + $text = add_links($text); - return $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 |