Class: Generators::HTMLGenerator

Inherits:
Object
  • Object
show all
Includes:
MarkUp
Defined in:
lib/rdoc/generators/html_generator.rb

Direct Known Subclasses

CHMGenerator, HTMLGeneratorInOne, XMLGenerator

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MarkUp

#cvs_url, #markup, #style_url

Constructor Details

#initialize(options) ⇒ HTMLGenerator

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



1178
1179
1180
1181
# File 'lib/rdoc/generators/html_generator.rb', line 1178

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

Class Method Details

.for(options) ⇒ Object

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



1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
# File 'lib/rdoc/generators/html_generator.rb', line 1160

def HTMLGenerator.for(options)
  AllReferences::reset
  HtmlMethod::reset

  if options.all_one_file
    HTMLGeneratorInOne.new(options)
  else
    HTMLGenerator.new(options)
  end
end

.gen_url(path, target) ⇒ Object

convert a target url to one that is relative to a given path



1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
# File 'lib/rdoc/generators/html_generator.rb', line 1138

def HTMLGenerator.gen_url(path, target)
  from          = File.dirname(path)
  to, to_file   = File.split(target)
  
  from = from.split("/")
  to   = to.split("/")
  
  while from.size > 0 and to.size > 0 and from[0] == to[0]
    from.shift
    to.shift
  end
  
  from.fill("..")
  from.concat(to)
  from << to_file
  File.join(*from)
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.



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/rdoc/generators/html_generator.rb', line 1189

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

  write_style_sheet
  gen_sub_directories()
  build_indices
  generate_html
end