lib/rdoc/generator/xml.rb in rdoc-2.2.1 vs lib/rdoc/generator/xml.rb in rdoc-2.3.0

- old
+ new

@@ -1,12 +1,15 @@ require 'rdoc/generator/html' +require 'rdoc/cache' ## # Generate XML output as one big file class RDoc::Generator::XML < RDoc::Generator::HTML + RDoc::RDoc.add_generator self + ## # Standard generator factory def self.for(options) new(options) @@ -39,35 +42,39 @@ # class or module in the TopLevel objects # * a complete list of all hyperlinkable terms (file, # class, module, and method names) def build_indices + template_cache = RDoc::Cache.instance + @info.each do |toplevel| - @files << RDoc::Generator::File.new(toplevel, @options, RDoc::Generator::FILE_DIR) + @files << RDoc::Generator::File.new(template_cache, toplevel, @options, + RDoc::Generator::FILE_DIR) end RDoc::TopLevel.all_classes_and_modules.each do |cls| - build_class_list(cls, @files[0], RDoc::Generator::CLASS_DIR) + build_class_list(template_cache, cls, @files[0], RDoc::Generator::CLASS_DIR) end end - def build_class_list(from, html_file, class_dir) - @classes << RDoc::Generator::Class.new(from, html_file, class_dir, @options) + def build_class_list(template_cache, from, html_file, class_dir) + @classes << RDoc::Generator::Class.new(template_cache, from, html_file, + class_dir, @options) from.each_classmodule do |mod| - build_class_list(mod, html_file, class_dir) + build_class_list(template_cache, mod, html_file, class_dir) end end ## # Generate all the HTML. For the one-file case, we generate # all the information in to one big hash def generate_xml values = { - 'charset' => @options.charset, - 'files' => gen_into(@files), - 'classes' => gen_into(@classes) + :charset => @options.charset, + :files => gen_into(@files), + :classes => gen_into(@classes) } template = RDoc::TemplatePage.new @template::ONE_PAGE if @options.op_name @@ -100,17 +107,17 @@ def gen_an_index(collection, title) res = [] collection.sort.each do |f| if f.document_self - res << { "href" => f.path, "name" => f.index_name } + res << { :href => f.path, :name => f.index_name } end end return { - "entries" => res, - 'list_title' => title, - 'index_url' => main_url, + :entries => res, + :list_title => title, + :index_url => main_url, } end end