Class: RDoc::Generator::HTML

Inherits:
Object
  • Object
show all
Includes:
MarkUp
Defined in:
lib/rdoc/generator/html.rb

Overview

We’re responsible for generating all the HTML files from the object tree defined in code_objects.rb. We generate:

files

an html file for each input file given. These input files appear as objects of class TopLevel

classes

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.

indices

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.

Direct Known Subclasses

CHM, HTMLInOne, XML

Defined Under Namespace

Modules: HEFSS, HTML, KILMER, ONE_PAGE_HTML

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HTML

Set up a new HTML generator. Basically all we do here is load up the correct output temlate



68
69
70
71
72
# File 'lib/rdoc/generator/html.rb', line 68

def initialize(options) #:not-new:
  @options = options
  load_html_template
  @main_page_path = nil
end

Class Method Details

.for(options) ⇒ Object

Generator may need to return specific subclasses depending on the options they are passed. Because of this we create them using a factory



49
50
51
52
53
54
55
56
57
58
# File 'lib/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

Instance Method Details

#generate(toplevels) ⇒ Object

Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.



79
80
81
82
83
84
85
86
87
88
# File 'lib/rdoc/generator/html.rb', line 79

def generate(toplevels)
  @toplevels  = toplevels
  @files      = []
  @classes    = []

  write_style_sheet
  gen_sub_directories()
  build_indices
  generate_html
end