Method: Generators::PuppetGenerator#gen_top_index

Defined in:
lib/puppet/util/rdoc/generators/puppet_generator.rb

#gen_top_index(collection, title, template, filename) ⇒ Object

generate a top index



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 214

def gen_top_index(collection, title, template, filename)
  template = TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
  res = []
  collection.sort.each do |f|
    if f.document_self
      res << { "classlist" => CGI.escapeHTML("#{MODULE_DIR}/fr_#{f.index_name}.html"), "module" => CGI.escapeHTML("#{CLASS_DIR}/#{f.index_name}.html"), "name" => CGI.escapeHTML(f.index_name) }
    end
  end

  values = {
    "entries" => res,
    'list_title' => CGI.escapeHTML(title),
    'index_url' => main_url,
    'charset' => @options.charset,
    'style_url' => style_url('', @options.css),
  }

  Puppet::FileSystem.open(filename, nil, "w:UTF-8") do |f|
    template.write_html_on(f, values)
  end
end