lib/code_zauker/webgui.rb in code_zauker-0.0.6 vs lib/code_zauker/webgui.rb in code_zauker-0.0.7

- old
+ new

@@ -22,10 +22,11 @@ if util.is_pdf?(f)==false askedQuery=params[:q] pattern=/#{Regexp.escape(askedQuery)}/i lines=grep(f,pattern, pre_context=2, post_context=2); desc="" - lines.each do |l | + lines.each do | l | + # http://stackoverflow.com/questions/1287630/ruby-gsub-and-regex hilighted=l.gsub(/(#{Regexp.escape(askedQuery)})/i){ "<b>#{$1}</b>"} desc=desc+ "#{f}:#{hilighted}\n" end abstracts.push(desc) end