lib/hanna/template_helpers.rb
def build_javascript_search_index(entries)
      result = "var search_index = [\n"
      entries.each do |entry|
        entry[:name] =~ /\A(.+) \((.+)\)\Z/
        method_name, module_name = $1, $2
        html = link_to_method(entry[:name], entry[:href])
        result << "  { method: '#{method_name.downcase}', " <<
                      "module: '#{module_name.downcase}', " <<
                      "html: '#{html}' },\n"
      end
      result << "]"
      result
    end
def build_javascript_search_index(entries)
      result = "var search_index = [\n"
      entries.each do |entry|
        entry[:name] =~ /\A(.+) \((.+)\)\Z/
        method_name, module_name = $1, $2
        html = link_to_method(entry[:name], entry[:href])
        result << "  { method: '#{method_name.downcase}', " <<
                      "module: '#{module_name.downcase}', " <<
                      "html: '#{html}' },\n"
      end
      result << "]"
      result
    end
+entries+ is an array of hashes, each which has a "name" and "href" element.
 An entry name is in the form of "ago (ActiveSupport::TimeWithZone)".
 +entries+ must be already sorted by name.