/[swish]/trunk/html/swish.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/html/swish.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 81 by dpavlin, Sat Aug 28 22:15:59 2004 UTC revision 82 by dpavlin, Sun Aug 29 18:17:15 2004 UTC
# Line 12  use Data::Pageset; Line 12  use Data::Pageset;
12    
13  sub get_snippet {  sub get_snippet {
14          my $context_chars = 100;          my $context_chars = 100;
15            my $max_desc = 16384;   # 16k to filter
16    
17          my $desc = shift || return '';          my $desc = shift || return '';
18            $desc = substr($desc,0,$max_desc) if (length($desc) > $max_desc);
19          # test if $desc contains any of our query words          # test if $desc contains any of our query words
20          my @snips;          my @snips;
21    
# Line 33  sub get_snippet { Line 35  sub get_snippet {
35                          $af =~ s,^\S+\s+|\s+\S+$,,gs;                          $af =~ s,^\S+\s+|\s+\S+$,,gs;
36                          $bef =~ s,^\S+\s+|\s+\S+$,,gs;                          $bef =~ s,^\S+\s+|\s+\S+$,,gs;
37    
38                          push(@snips, "$bef <span style=\"background:".$colors[$i]."\">$qm</span> $af");                          push(@snips, "$bef <span style=\"background:".$colors[$i]."; color:black;\">$qm</span> $af");
39                          $i++;                          $i++;
40                          $i = 0 if ($i > $#colors);                          $i = 0 if ($i > $#colors);
41                  }                  }
42          }          }
43          my $ellip = ' ... ';          my $ellip = ' ... ';
44          my $snippet = $ellip. join($ellip, @snips) . $ellip;          my $snippet = $ellip. join($ellip, @snips) . $ellip if (@snips);
45        
46          return $snippet;          return $snippet;
47  }  }

Legend:
Removed from v.81  
changed lines
  Added in v.82

  ViewVC Help
Powered by ViewVC 1.1.26