1 require 'rdoc/generator/html'
4 # Generate XML output as one big file
6 class RDoc::Generator::XML < RDoc::Generator::HTML
9 # Standard generator factory
20 # Build the initial indices and output objects
21 # based on an array of TopLevel objects containing
22 # the extracted information.
37 # * a list of HtmlFile objects for each TopLevel object.
38 # * a list of HtmlClass objects for each first level
39 # class or module in the TopLevel objects
40 # * a complete list of all hyperlinkable terms (file,
41 # class, module, and method names)
44 @info.each do |toplevel|
45 @files << RDoc::Generator::HtmlFile.new(toplevel, @options, RDoc::Generator::FILE_DIR)
48 RDoc::TopLevel.all_classes_and_modules.each do |cls|
49 build_class_list(cls, @files[0], RDoc::Generator::CLASS_DIR)
53 def build_class_list(from, html_file, class_dir)
54 @classes << RDoc::Generator::HtmlClass.new(from, html_file, class_dir, @options)
55 from.each_classmodule do |mod|
56 build_class_list(mod, html_file, class_dir)
61 # Generate all the HTML. For the one-file case, we generate
62 # all the information in to one big hash
66 'charset' => @options.charset,
67 'files' => gen_into(@files),
68 'classes' => gen_into(@classes)
71 # this method is defined in the template file
72 write_extra_pages if defined? write_extra_pages
74 template = RDoc::TemplatePage.new @template::ONE_PAGE
77 opfile = File.open(@options.op_name, "w")
81 template.write_html_on(opfile, values)
87 res << item.value_hash
93 gen_an_index(@files, 'Files')
97 gen_an_index(@classes, 'Classes')
101 gen_an_index(RDoc::Generator::HtmlMethod.all_methods, 'Methods')
104 def gen_an_index(collection, title)
106 collection.sort.each do |f|
108 res << { "href" => f.path, "name" => f.index_name }
114 'list_title' => title,
115 'index_url' => main_url,