Skip to content

Commit

Permalink
Item9914: METASEARCH fails to expand topic(number, ..) and probably o…
Browse files Browse the repository at this point in the history
…ther

Item9913: SEARCH fails to expand several tokens like topic(number, ...)
Item9911: SEARCH format is parsed through formatTime causing all sorts of problems


git-svn-id: http://svn.foswiki.org/trunk@9776 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Oct 27, 2010
1 parent 695d0a0 commit fab1b05
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/lib/Foswiki/Search.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,19 @@ sub formatResult {

#SMELL: hack to stop non-topic based FORMAT's from doing topic code
#TODO: this should be extracted into the customKeys above
$out = $session->renderer->renderRevisionInfo( $topicObject, $revNum, $out )
if ( defined($topic) );
# Note that we cannot send a formatted search through renderRevisionInfo
# without expanding tokens we should not because the function also sends
# the input through formatTime and probably other nasty filters
# So we send each token through one by one.
if ( defined $topic ) {

$out =~ s/\$web/$web/gs;
$out =~ s/\$topic\(([^\)]*)\)/Foswiki::Render::breakName(
$topic, $1 )/ges;
$out =~ s/\$topic/$topic/gs;
$out =~ s{(\$rev|\$wikiusername|\$wikiname|\$username|\$createlongdate|\$iso|\$longdate|\$date)}
{$session->renderer->renderRevisionInfo($topicObject, $revNum, $1 )}ges;
}
if ( $out =~ m/\$text/ and defined($topic) )
{ #TODO: don't muck with text if we're not even a topic
Expand Down

0 comments on commit fab1b05

Please sign in to comment.