*** HTML.pm 2004-03-16 08:30:47-08 1.1
--- HTML.pm 2004-03-29 17:10:04-08
***************
*** 18,27 ****
# elements defined by the HTML 4.01 and XHTML 1.0 DTDs (do not change them!)
$re_loose = 'applet|basefont|center|dir|font|frame|frameset|iframe|isindex|menu|noframes|s|strike|u';
! $re_strict = 'a|abbr|acronym|address|area|b|base|bdo|big|blockquote|body|br|button|caption|cite|code|col|colgroup|dd|del|dfn|div|dl|dt|em|fieldset|form|h1|h2|h3|h4|h5|h6|head|hr|html|i|img|input|ins|kbd|label|legend|li|link|map|meta|noscript|object|ol|optgroup|option|p|param|pre|q|samp|script|select|small|span|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|ul|var';
# loose list of HTML events
! $events = 'on(?:activate|afterupdate|beforeactivate|beforecopy|beforecut|beforedeactivate|beforeeditfocus|beforepaste|beforeupdate|blur|change|click|contextmenu|controlselect|copy|cut|dblclick|deactivate|errorupdate|focus|focusin|focusout|help|keydown|keypress|keyup|load|losecapture|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|move|moveend|movestart|paste|propertychange|readystatechange|reset|resize|resizeend|resizestart|select|submit|timeerror|unload)';
my %tested_colors;
--- 18,27 ----
# elements defined by the HTML 4.01 and XHTML 1.0 DTDs (do not change them!)
$re_loose = 'applet|basefont|center|dir|font|frame|frameset|iframe|isindex|menu|noframes|s|strike|u';
! $re_strict = '(defanged_)?(?:a|abbr|acronym|address|area|b|base|bdo|big|blockquote|body|br|button|caption|cite|code|col|colgroup|dd|del|dfn|div|dl|dt|em|fieldset|form|h1|h2|h3|h4|h5|h6|head|hr|html|i|img|input|ins|kbd|label|legend|li|link|map|meta|noscript|object|ol|optgroup|option|p|param|pre|q|samp|script|select|small|span|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|ul|var)';
# loose list of HTML events
! $events = '(defanged_)?on(?:activate|afterupdate|beforeactivate|beforecopy|beforecut|beforedeactivate|beforeeditfocus|beforepaste|beforeupdate|blur|change|click|contextmenu|controlselect|copy|cut|dblclick|deactivate|errorupdate|focus|focusin|focusout|help|keydown|keypress|keyup|load|losecapture|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|move|moveend|movestart|paste|propertychange|readystatechange|reset|resize|resizeend|resizestart|select|submit|timeerror|unload)';
my %tested_colors;
***************
*** 80,86 ****
elsif ($tag eq "p" || $tag eq "hr") {
push @{$self->{html_text}}, "\n\n";
}
! elsif ($tag eq "img" && exists $attr->{alt} && $attr->{alt} ne "") {
push @{$self->{html_text}}, " $attr->{alt} ";
}
}
--- 80,86 ----
elsif ($tag eq "p" || $tag eq "hr") {
push @{$self->{html_text}}, "\n\n";
}
! elsif (($tag eq "img" || $tag eq "defanged_img") && exists $attr->{alt} && $attr->{alt} ne "") {
push @{$self->{html_text}}, " $attr->{alt} ";
}
}
***************
*** 96,102 ****
elsif ($tag =~ /^(?:a|area|link)$/) {
push @{$self->{html_text}}, "URI:$uri " if $uri = $attr->{href};
}
! elsif ($tag =~ /^(?:img|frame|iframe|embed|script)$/) {
push @{$self->{html_text}}, "URI:$uri " if $uri = $attr->{src};
}
elsif ($tag eq "form") {
--- 96,102 ----
elsif ($tag =~ /^(?:a|area|link)$/) {
push @{$self->{html_text}}, "URI:$uri " if $uri = $attr->{href};
}
! elsif ($tag =~ /^(defanged_)?(?:img|frame|iframe|embed|script)$/) {
push @{$self->{html_text}}, "URI:$uri " if $uri = $attr->{src};
}
elsif ($tag eq "form") {
***************
*** 364,370 ****
if ($tag eq "script") {
$self->{html}{javascript} = 1;
}
! if ($tag =~ /^(?:a|body|div|input|form|td|layer|area|img)$/i) {
for (keys %$attr) {
if (/\b(?:$events)\b/io)
{
--- 364,370 ----
if ($tag eq "script") {
$self->{html}{javascript} = 1;
}
! if ($tag =~ /^(defanged_)?(?:a|body|div|input|form|td|layer|area|img)$/i) {
for (keys %$attr) {
if (/\b(?:$events)\b/io)
{
***************
*** 443,449 ****
$self->{html}{big_font} = 1 if (lc($type) eq "pt" && $size > 12);
}
}
! if ($tag eq "img" && exists $attr->{width} && exists $attr->{height}) {
my $width = 0;
my $height = 0;
my $area = 0;
--- 443,449 ----
$self->{html}{big_font} = 1 if (lc($type) eq "pt" && $size > 12);
}
}
! if (($tag eq "img" || $tag eq "defanged_img") && exists $attr->{width} && exists $attr->{height}) {
my $width = 0;
my $height = 0;
my $area = 0;
***************
*** 610,616 ****
sub html_image_only {
my ($self, undef, $min, $max) = @_;
! return (exists $self->{html_inside}{'img'} &&
exists $self->{html}{non_space_len} &&
$self->{html}{non_space_len} > $min &&
$self->{html}{non_space_len} <= $max &&
--- 610,616 ----
sub html_image_only {
my ($self, undef, $min, $max) = @_;
! return ((exists $self->{html_inside}{'img'} || exists $self->{html_inside}{'defanged_img'}) &&
exists $self->{html}{non_space_len} &&
$self->{html}{non_space_len} > $min &&
$self->{html}{non_space_len} <= $max &&