git-svn-id: http://redmine.rubyforge.org/svn/trunk@1709 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/0.8.0-RC1
@@ -18,7 +18,8 @@ | |||
module SearchHelper | |||
def highlight_tokens(text, tokens) | |||
return text unless text && tokens && !tokens.empty? | |||
regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE | |||
re_tokens = tokens.collect {|t| Regexp.escape(t)} | |||
regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE | |||
result = '' | |||
text.split(regexp).each_with_index do |words, i| | |||
if result.length > 1200 |