Class | RDoc::Generator::XHTML |
In: |
generator/xhtml.rb
|
Parent: | RDoc::Generator::HTML |
We‘re responsible for generating all the HTML files from the object tree defined in code_objects.rb. We generate:
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.
# File generator/xhtml.rb, line 78 78: def copy_xsls 79: xsl_files = ["mathml.xsl", "pmathmlcss.xsl", "ctop.xsl", "pmathml.xsl"] 80: xsl_dir = "rdoc/generator/xhtml" 81: hit = 0 82: $LOAD_PATH.each{ |path| 83: hit = 0 84: xsl_files.each{ |file| 85: hit += 1 if ::File.exist?(::File.join(path, xsl_dir, file)) 86: } 87: if hit >= 4 88: xsl_files.each{ |file| 89: ::FileUtils.copy(::File.join(path, xsl_dir, file), "./") 90: } 91: break 92: else 93: hit = 0 94: end 95: } 96: if hit < 4 97: $stderr.puts "Couldn't find xsl files (#{xsl_files.join(', ')})\n" 98: exit 99: end 100: end
# File generator/xhtml.rb, line 44 44: def gen_an_index(collection, title, template, filename) 45: template = RDoc::TemplatePage.new @template::FR_INDEX_BODY, template 46: res = [] 47: collection.sort.each do |f| 48: if f.document_self 49: res << { "href" => f.path, "name" => f.index_name } 50: end 51: end 52: 53: values = { 54: "entries" => res, 55: 'list_title' => CGI.escapeHTML(title), 56: 'index_url' => main_url, 57: 'charset' => @options.charset, 58: 'style_url' => style_url('', @options.css), 59: 'mathml_xsl_url' => style_url('', "mathml.xsl"), 60: } 61: 62: open filename, 'w' do |f| 63: template.write_html_on(f, values) 64: end 65: end