Class: Generators::HTMLGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generators/template/html/resh/resh.rb

Instance Method Summary collapse

Instance Method Details

#gen_an_index(collection, title, template, filename) ⇒ Object

Not used



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 100

def gen_an_index(collection, title, template, filename)
	return unless RDoc::Page.constants.include? title.upcase
	res = []
	collection.sort.each do |f|
		if f.document_self
			res << { "href" => f.path, "name" => f.index_name }
		end
	end

	values = {
		"entries"    => res,
		'list_title' => CGI.escapeHTML(title),
		'index_url'  => main_url,
		'charset'    => @options.charset,
		'style_url'  => style_url('', @options.css),
	}
	File.open(filename, "w") {|f|
		f << ERB.new(File.read($tmpl+RDoc::Page.const_get(title.upcase))).result(binding)
	}
end

#gen_main_indexObject



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 121

def gen_main_index
	return unless defined? RDoc::Page::INDEX
	File.open("index.html", "w") do |f|
		values = {
			"initial_page" => main_url,
			'title'        => CGI.escapeHTML(@options.title),
			'charset'      => @options.charset,
			'style_url'  => style_url('', @options.css),
		}
		if @options.inline_source
			values['inline_source'] = true
		end
		f << ERB.new(File.read($tmpl+RDoc::Page::INDEX)).result(binding)
	end
end

#generate(toplevels) ⇒ Object

Overrides generate method to change order of processing. write_style_sheet should be processed at last.



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 80

def generate(toplevels)
	@options.instance_eval "@inline_source = true"
	@toplevels  = toplevels
	@files      = []
	@classes    = []

	gen_sub_directories()
	build_indices
	generate_html
	write_style_sheet
end

#generate_xmlObject

Not used.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 138

def generate_xml
	values = {
		'charset' => @options.charset,
		'files'   => gen_into(@files),
		'classes' => gen_into(@classes),
		'title'   => CGI.escapeHTML(@options.title),
	}

	# this method is defined in the template file
	write_extra_pages if defined? write_extra_pages

	if @options.op_name
		opfile = File.open(@options.op_name, "w")
	else
		opfile = $stdout
	end
	File.open(opfile, "w") {|f|
		f << ERB.new(File.read($tmpl+RDoc::Page::ONE_PAGE)).result(binding)
	}
end

#write_style_sheetObject



92
93
94
95
96
97
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 92

def write_style_sheet
	return unless defined? RDoc::Page::STYLE
	File.open(::Generators::CSS_NAME, "w") {|f|
		f << ERB.new(File.read($tmpl+RDoc::Page::STYLE)).result(binding)
	}
end