Skip to content

Commit

Permalink
Item8809: SEARCH newline $n does not work
Browse files Browse the repository at this point in the history
Still need to add unit test to verify this special case


git-svn-id: http://svn.foswiki.org/trunk@7011 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Mar 31, 2010
1 parent 960b6a4 commit f329d05
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/lib/Foswiki/Search.pm
Expand Up @@ -399,19 +399,25 @@ sub searchWeb {
my $prefs = $session->{prefs};

my $mixedAlpha = $Foswiki::regex{mixedAlpha};

# separator defines what separates each search result
# excluding header and footer
# Replace $n and $n() with \n for separator
my $separator = $params{separator};
if ( defined($separator) ) {
$separator =~ s/\$n\(\)/\n/gos; # expand "$n()" to new line
$separator =~ s/\$n([^$mixedAlpha]|$)/\n$1/gos;
}
$params{separator} = $separator;

#TODO: this code ($newLine) does not seem to be used. Fix needed.
# newline feature replaces newlines within each search result
# Replace $n and $n() with \n for newLine
my $newLine = $params{newline} || '';
if ($newLine) {
$newLine =~ s/\$n\(\)/\n/gos; # expand "$n()" to new line
$newLine =~ s/\$n([^$mixedAlpha]|$)/\n$1/gos;
}
$params{newline} = $newLine;

my ( $numberOfResults, $web_searchResult ) =
$this->formatResults( $query, $infoCache, \%params );
Expand Down

0 comments on commit f329d05

Please sign in to comment.