We're responsible for generating all the HTML files from the object tree defined in code_objects.rb. We generate:
an html file for each input file given. These input files appear as objects of class TopLevel
an html file for each class or module encountered. These classes are not grouped by file: if a file contains four classes, we'll generate an html file for the file itself, and four html files for the individual classes.
we generate three indices for files, classes, and methods. These are displayed in a browser like window with three index panes across the top and the selected description below
Method descriptions appear in whatever entity (file, class, or module) that contains them.
We generate files in a structure below a specified subdirectory, normally
doc.
opdir
|
|___ files
| |__ per file summaries
|
|___ classes
|__ per class/module descriptions
HTML is generated using the Template class.
Generator may need to return specific subclasses depending on the options they are passed. Because of this we create them using a factory
# File rdoc/generator/html.rb, line 49
def self.for(options)
RDoc::Generator::AllReferences.reset
RDoc::Generator::Method.reset
if options.all_one_file
RDoc::Generator::HTMLInOne.new options
else
new options
end
end
Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.
# File rdoc/generator/html.rb, line 78
def generate(toplevels)
@toplevels = toplevels
@files = []
@classes = []
write_style_sheet
gen_sub_directories
build_indices
generate_html
end
Set up a new HTML generator. Basically all we do here is load up the correct output temlate
# File rdoc/generator/html.rb, line 68
def initialize(options) #:not-new:
@options = options
load_html_template
end