Class | Generators::HTMLGeneratorInOne |
In: |
lib/rdoc/generators/html_generator.rb
|
Parent: | HTMLGenerator |
# File lib/rdoc/generators/html_generator.rb, line 1400 1400: def initialize(*args) 1401: super 1402: end
# File lib/rdoc/generators/html_generator.rb, line 1440 1440: def build_class_list(from, html_file, class_dir) 1441: @classes << HtmlClass.new(from, html_file, class_dir, @options) 1442: from.each_classmodule do |mod| 1443: build_class_list(mod, html_file, class_dir) 1444: end 1445: end
Generate:
# File lib/rdoc/generators/html_generator.rb, line 1429 1429: def build_indices 1430: 1431: @toplevels.each do |toplevel| 1432: @files << HtmlFile.new(toplevel, @options, FILE_DIR) 1433: end 1434: 1435: RDoc::TopLevel.all_classes_and_modules.each do |cls| 1436: build_class_list(cls, @files[0], CLASS_DIR) 1437: end 1438: end
# File lib/rdoc/generators/html_generator.rb, line 1493 1493: def gen_an_index(collection, title) 1494: res = [] 1495: collection.sort.each do |f| 1496: if f.document_self 1497: res << { "href" => f.path, "name" => f.index_name } 1498: end 1499: end 1500: 1501: return { 1502: "entries" => res, 1503: 'list_title' => title, 1504: 'index_url' => main_url, 1505: } 1506: end
# File lib/rdoc/generators/html_generator.rb, line 1484 1484: def gen_class_index 1485: gen_an_index(@classes, 'Classes') 1486: end
# File lib/rdoc/generators/html_generator.rb, line 1480 1480: def gen_file_index 1481: gen_an_index(@files, 'Files') 1482: end
# File lib/rdoc/generators/html_generator.rb, line 1472 1472: def gen_into(list) 1473: res = [] 1474: list.each do |item| 1475: res << item.value_hash 1476: end 1477: res 1478: end
# File lib/rdoc/generators/html_generator.rb, line 1488 1488: def gen_method_index 1489: gen_an_index(HtmlMethod.all_methods, 'Methods') 1490: end
Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.
# File lib/rdoc/generators/html_generator.rb, line 1409 1409: def generate(info) 1410: @toplevels = info 1411: @files = [] 1412: @classes = [] 1413: @hyperlinks = {} 1414: 1415: build_indices 1416: generate_xml 1417: end
Generate all the HTML. For the one-file case, we generate all the information in to one big hash
# File lib/rdoc/generators/html_generator.rb, line 1451 1451: def generate_xml 1452: values = { 1453: 'charset' => @options.charset, 1454: 'files' => gen_into(@files), 1455: 'classes' => gen_into(@classes), 1456: 'title' => CGI.escapeHTML(@options.title), 1457: } 1458: 1459: # this method is defined in the template file 1460: write_extra_pages if defined? write_extra_pages 1461: 1462: template = TemplatePage.new(RDoc::Page::ONE_PAGE) 1463: 1464: if @options.op_name 1465: opfile = File.open(@options.op_name, "w") 1466: else 1467: opfile = $stdout 1468: end 1469: template.write_html_on(opfile, values) 1470: end