You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2004/02/18 21:44:57 UTC

svn commit: rev 6720 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin rules

Author: quinlan
Date: Wed Feb 18 12:44:56 2004
New Revision: 6720

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
   incubator/spamassassin/trunk/rules/20_html_tests.cf
   incubator/spamassassin/trunk/rules/70_testing.cf
Log:
add minimal support for <marquee> and a marquee rule
turn hue code into a sub


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	Wed Feb 18 12:44:56 2004
@@ -176,7 +176,7 @@
   $self->{html}{"inside_$tag"} = 0 if $self->{html}{"inside_$tag"} < 0;
 
   # TODO: cover other changes
-  if ($tag =~ /^(?:body|font|table|tr|th|td|big|small|basefont)$/) {
+  if ($tag =~ /^(?:body|font|table|tr|th|td|big|small|basefont|marquee)$/) {
     $self->text_style($tag, $attr, $num);
   }
 
@@ -724,42 +724,46 @@
   }
 }
 
-sub html_font_color_tests {
-  my ($self, $c) = @_;
+sub color_hue {
+  my ($color) = @_;
 
-  if ($c =~ /^\#?[0-9a-f]{6}$/ && $c !~ /^\#?(?:00|33|66|80|99|cc|ff){3}$/) {
-    $self->{html}{font_color_unsafe} = 1;
-  }
-  if ($c !~ /^\#?[0-9a-f]{6}$/ && !exists $html_color{$c}) {
-    $self->{html}{font_color_name} = 1;
-  }
-  if ($c =~ /^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/) {
+  if ($color =~ /^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i) {
     my ($h, $s, $v) = rgb_to_hsv(hex($1), hex($2), hex($3));
-    if (!defined($h)) {
-      $self->{html}{font_gray} = 1 unless ($v == 0 || $v == 255);
+    if (!defined $h) {
+      return "gray" unless ($v == 0 || $v == 255);
     }
     elsif ($h < 30 || $h >= 330) {
-      $self->{html}{font_red} = 1;
+      return "red";
     }
     elsif ($h < 90) {
-      $self->{html}{font_yellow} = 1;
+      return "yellow";
     }
     elsif ($h < 150) {
-      $self->{html}{font_green} = 1;
+      return "green";
     }
     elsif ($h < 210) {
-      $self->{html}{font_cyan} = 1;
+      return "cyan";
     }
     elsif ($h < 270) {
-      $self->{html}{font_blue} = 1;
+      return "blue";
     }
     elsif ($h < 330) {
-      $self->{html}{font_magenta} = 1;
+      return "magenta";
     }
   }
-  else {
-    $self->{html}{font_color_unknown} = 1;
+  return "hue_unknown";
+}
+
+sub html_font_color_tests {
+  my ($self, $c) = @_;
+
+  if ($c =~ /^\#?[0-9a-f]{6}$/ && $c !~ /^\#?(?:00|33|66|80|99|cc|ff){3}$/) {
+    $self->{html}{font_color_unsafe} = 1;
+  }
+  if ($c !~ /^\#?[0-9a-f]{6}$/ && !exists $html_color{$c}) {
+    $self->{html}{font_color_name} = 1;
   }
+  $self->{html}{"font_" . color_hue($c)} = 1;
 }
 
 sub html_font_invisible {

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	Wed Feb 18 12:44:56 2004
@@ -143,7 +143,7 @@
 body HTML_FONTCOLOR_MAGENTA		eval:html_test('font_magenta')
 describe HTML_FONTCOLOR_MAGENTA	HTML font color is magenta
 
-body HTML_FONTCOLOR_UNKNOWN		eval:html_test('font_color_unknown')
+body HTML_FONTCOLOR_UNKNOWN		eval:html_test('font_hue_unknown')
 describe HTML_FONTCOLOR_UNKNOWN	HTML font color is unknown to us
 
 body HTML_FONT_FACE_BAD		eval:html_test('font_face_bad')

Modified: incubator/spamassassin/trunk/rules/70_testing.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/70_testing.cf	(original)
+++ incubator/spamassassin/trunk/rules/70_testing.cf	Wed Feb 18 12:44:56 2004
@@ -642,5 +642,8 @@
 body T_HTML_FONT_LARGE_SIZE_3	eval:html_eval('max_size', '> 7')
 body T_HTML_FONT_LARGE_SIZE_4	eval:html_eval('max_size', '> 8')
 
+body T_HTML_TAG_EXISTS_MARQUEE	eval:html_tag_exists('marquee')
+describe T_HTML_TAG_EXISTS_MARQUEE	HTML has "marquee" tag
+
 # bug 1985
 body T_URGENT_BIZ /urgent.{0,16}(?:assistance|business|buy|confidential|notice|proposal|reply|request|response)/i