Mailing List Archive

svn commit: rev 6834 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin rules
Author: quinlan
Date: Mon Feb 23 00:18:56 2004
New Revision: 6834

Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
incubator/spamassassin/trunk/rules/20_html_tests.cf
incubator/spamassassin/trunk/rules/70_testing.cf
Log:
HTML title code update
remove some unnecessary double quotes


Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Mon Feb 23 00:18:56 2004
@@ -3400,7 +3400,7 @@

sub html_title {
my ($self, undef, $expr) = @_;
- for my $title (@{ $self->{html}{t_title} }) {
+ for my $title (@{ $self->{html}{title} }) {
if (defined $title && eval "qq{\Q$title\E} $expr") {
return 1;
}

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm Mon Feb 23 00:18:56 2004
@@ -899,12 +899,11 @@
}
if ($tag eq "title") {
$self->{html}{title_index}++;
- $self->{html}{title_text} = "" if ($self->{html}{title_index} == 0);
+ $self->{html}{title}->[$self->{html}{title_index}] = "";

# begin test code
- $self->{html}{t_title}->[$self->{html}{title_index}] = "";
if ($self->{html}{title_index} > 0) {
- $self->{html}{t_title_extra}++;
+ $self->{html}{title_extra}++;
}
# end test code
}
@@ -932,11 +931,11 @@
sub html_text {
my ($self, $text) = @_;

- if (exists $self->{html}{"inside_a"} && $self->{html}{"inside_a"} > 0) {
+ if (exists $self->{html}{inside_a} && $self->{html}{inside_a} > 0) {
$self->{html}{anchor_text} .= " $text";
}

- if (exists $self->{html}{"inside_script"} && $self->{html}{"inside_script"} > 0)
+ if (exists $self->{html}{inside_script} && $self->{html}{inside_script} > 0)
{
if ($text =~ /\b(?:$events)\b/io)
{
@@ -952,17 +951,16 @@
return;
}

- if (exists $self->{html}{"inside_style"} && $self->{html}{"inside_style"} > 0) {
+ if (exists $self->{html}{inside_style} && $self->{html}{inside_style} > 0) {
if ($text =~ /font(?:-size)?:\s*(\d+(?:\.\d*)?|\.\d+)(p[tx])/i) {
$self->examine_text_style ($1, $2);
}
return;
}

- if (exists $self->{html}{"inside_title"} && $self->{html}{"inside_title"} > 0)
+ if (exists $self->{html}{inside_title} && $self->{html}{inside_title} > 0)
{
- $self->{html}{title_text} .= $text if ($self->{html}{title_index} == 0);
- $self->{html}{t_title}->[$self->{html}{title_index}] .= $text;
+ $self->{html}{title}->[$self->{html}{title_index}] .= $text;
}

$self->html_font_invisible($text) if $text =~ /[^ \t\n\r\f\x0b\xa0]/;
@@ -992,7 +990,7 @@
{
$self->{html}{div_converted} = 1;
}
- if (exists $self->{html}{"inside_script"} && $self->{html}{"inside_script"} > 0)
+ if (exists $self->{html}{inside_script} && $self->{html}{inside_script} > 0)
{
if ($text =~ /\b(?:$events)\b/io)
{
@@ -1008,7 +1006,7 @@
return;
}

- if (exists $self->{html}{"inside_style"} && $self->{html}{"inside_style"} > 0) {
+ if (exists $self->{html}{inside_style} && $self->{html}{inside_style} > 0) {
if ($text =~ /font(?:-size)?:\s*(\d+(?:\.\d*)?|\.\d+)(p[tx])/i) {
$self->examine_text_style ($1, $2);
}

Modified: incubator/spamassassin/trunk/rules/20_html_tests.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_html_tests.cf (original)
+++ incubator/spamassassin/trunk/rules/20_html_tests.cf Mon Feb 23 00:18:56 2004
@@ -331,7 +331,7 @@
body HTML_TITLE_EMPTY eval:html_title('!~ /\S/s')
describe HTML_TITLE_EMPTY HTML title contains no text

-body HTML_TITLE_UNTITLED eval:html_eval('title_text', '=~ /Untitled/i')
+body HTML_TITLE_UNTITLED eval:html_title('=~ /untitled/i')
describe HTML_TITLE_UNTITLED HTML title contains "Untitled"

###########################################################################

Modified: incubator/spamassassin/trunk/rules/70_testing.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/70_testing.cf (original)
+++ incubator/spamassassin/trunk/rules/70_testing.cf Mon Feb 23 00:18:56 2004
@@ -205,10 +205,9 @@
# HTML title rules

# this won't work well until we parse HTML documents separately
-body T_HTML_TITLE_EXTRA eval:html_test('t_title_extra')
+body T_HTML_TITLE_EXTRA eval:html_test('title_extra')

# possible replacement rules
-body T_HTML_TITLE_UNTITLED_1 eval:html_title('=~ /untitled/i')
body T_HTML_TITLE_UNTITLED_2 eval:html_title('=~ /new page \d+/i')
body T_HTML_TITLE_UNTITLED_3 eval:html_title('=~ /untitled|new page \d+/i')