version 1.282, 2009/12/08 13:33:12
|
version 1.283, 2009/12/22 06:14:35
|
Line 41 use Apache::lonnavmaps;
|
Line 41 use Apache::lonnavmaps;
|
use Apache::lonenc(); |
use Apache::lonenc(); |
use Apache::lonrss(); |
use Apache::lonrss(); |
use HTML::LCParser(); |
use HTML::LCParser(); |
|
#use HTML::Tidy::libXML; |
use Apache::lonspeller(); |
use Apache::lonspeller(); |
use Apache::longroup; |
use Apache::longroup; |
use Cwd; |
use Cwd; |
Line 2678 sub clear_out_html {
|
Line 2679 sub clear_out_html {
|
($override)) { |
($override)) { |
# allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> |
# allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> |
# <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB> |
# <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB> |
# <SUP> |
# <SUP> <TABLE> <TR> <TD> <TH> <TBODY> |
%html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, |
%html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, |
BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, |
BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, |
M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1, |
M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1, |
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1, |
|
TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1); |
} |
} |
# Do the substitution of everything that is not explicitly allowed |
# Do the substitution of everything that is not explicitly allowed |
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ |
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ |
Line 2958 sub contains_block_html {
|
Line 2960 sub contains_block_html {
|
( |
( |
[\s]*[\/]>| |
[\s]*[\/]>| |
>.*<\/\1[\s]*> |
>.*<\/\1[\s]*> |
)/x ); |
)/xs ); |
} |
} |
|
|
|
sub tidy_html { |
|
my ($message)=@_; |
|
# my $tidy = HTML::Tidy::libXML->new(); |
|
# my $xhtml = $tidy->clean($message, 'utf-8', 1); |
|
# $xhtml =~ m/<body>(.*)<\/body>/is; |
|
# my $clean = $1; |
|
# # remove any empty block-level tags |
|
# $clean =~ s/<(table|p|div|tbody|blockquote|m|pre|algebra|center|ol|ul|span|h1|h2|h3|h4|h5|h6)\s*\/>//i; |
|
# $message=$clean; |
|
return $message; |
|
} |
|
|
sub newline_to_br { |
sub newline_to_br { |
my ($message)=@_; |
my ($message)=@_; |
my $newmessage; |
my $newmessage; |
Line 4145 None
|
Line 4159 None
|
|
|
=item newline_to_br() |
=item newline_to_br() |
|
|
|
=item tidy_html() |
|
|
=item generate_preview_button() |
=item generate_preview_button() |
|
|
=item modify_attachments() |
=item modify_attachments() |