1 package Newslash::Model::Util;
2 use Newslash::Model::Base -base;
10 =head2 tidy_html($html)
35 my ($self, $html) = @_;
36 my $tidy = HTML::Tidy->new( {
39 'show-body-only' => 1,
41 my $tidied = $tidy->clean($html);
45 =head2 clean_html(\%allowed, $html)
61 allowed tag and attribute
74 my ($self, $allowed, $html) = @_;
75 my $escaped = $self->escape_html($allowed, $html);
76 $escaped = EscapeHTML::blank_line_to_paragraph($escaped);
78 my $tidy = HTML::Tidy->new( {
81 'show-body-only' => 1,
83 my $tidied = $tidy->clean($escaped);
89 =head2 escape_html(\%allowed, $html)
105 allowed tag and attribute
118 my ($self, $allowed, $html) = @_;
119 return EscapeHTML::escape($allowed, $html);
123 =head2 escape_plaintext($text)
147 sub escape_plaintext {
148 my ($self, $text) = @_;
150 $text =~ s/(?!|lt;|gt;)/&/g;