# Based on Camping flipbook_rdoc by _why. # http://code.whytheluckystiff.net/svn/camping/trunk/extras/flipbook_rdoc.rb SITE_DIR = File.expand_path(File.dirname(__FILE__)) module Generators class HTMLGenerator def generate_html @files_and_classes = { 'allfiles' => gen_into_index(@files), 'allclasses' => gen_into_index(@classes), "initial_page" => main_url, 'realtitle' => CGI.escapeHTML(@options.title), 'charset' => @options.charset } # the individual descriptions for files and classes gen_into(@files) gen_into(@classes) gen_main_index # this method is defined in the template file write_extra_pages if defined? write_extra_pages end def gen_into(list) hsh = @files_and_classes.dup list.each do |item| if item.document_self op_file = item.path hsh['root'] = item.path.split("/").map { ".." }[1..-1].join("/") item.instance_variable_set("@values", hsh) File.makedirs(File.dirname(op_file)) File.open(op_file, "w") { |file| item.write_on(file) } end end end def gen_into_index(list) res = [] list.each do |item| hsh = item.value_hash hsh['href'] = item.path hsh['name'] = item.index_name res << hsh end res end def gen_main_index template = TemplatePage.new(RDoc::Page::INDEX) File.open("index.html", "w") do |f| values = @files_and_classes.dup if @options.inline_source values['inline_source'] = true end template.write_html_on(f, values) end ['logo.gif'].each do |img| ipath = File.join(SITE_DIR, 'images', img) File.copy(ipath, img) end end end end module RDoc module Page ###################################################################### # # The following is used for the -1 option # FONTS = "verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif" STYLE = File.read(SITE_DIR + '/style.css') CONTENTS_XML = %{ IF:description %description% ENDIF:description IF:requires Requires: START:requires IF:aref %name% ENDIF:aref IFNOT:aref %name% ENDIF:aref END:requires ENDIF:requires IF:attributes
| %name% | %rw% | %a_desc% |
[ show source ]
%sourcecode%
| %type% %category% methods |
| IF:callseq %callseq% ENDIF:callseq IFNOT:callseq %name%%params% ENDIF:callseq IF:codeurl src ENDIF:codeurl |
[ show source ]
%sourcecode%