Add additional information to RDoc template values
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7425f59f10
commit
3938f9db46
@ -634,7 +634,7 @@ module RDoc::Generators
|
|||||||
d = markup(@context.comment)
|
d = markup(@context.comment)
|
||||||
@values["description"] = d unless d.empty?
|
@values["description"] = d unless d.empty?
|
||||||
|
|
||||||
ml = build_method_summary_list
|
ml = build_method_summary_list @path
|
||||||
@values["methods"] = ml unless ml.empty?
|
@values["methods"] = ml unless ml.empty?
|
||||||
|
|
||||||
il = build_include_list(@context)
|
il = build_include_list(@context)
|
||||||
@ -692,6 +692,7 @@ module RDoc::Generators
|
|||||||
def class_attribute_values
|
def class_attribute_values
|
||||||
h_name = CGI.escapeHTML(name)
|
h_name = CGI.escapeHTML(name)
|
||||||
|
|
||||||
|
@values["path"] = @path
|
||||||
@values["classmod"] = @is_module ? "Module" : "Class"
|
@values["classmod"] = @is_module ? "Module" : "Class"
|
||||||
@values["title"] = "#{@values['classmod']}: #{h_name}"
|
@values["title"] = "#{@values['classmod']}: #{h_name}"
|
||||||
|
|
||||||
@ -894,7 +895,7 @@ module RDoc::Generators
|
|||||||
|
|
||||||
@@all_methods = []
|
@@all_methods = []
|
||||||
|
|
||||||
def HtmlMethod::reset
|
def self.reset
|
||||||
@@all_methods = []
|
@@all_methods = []
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1028,7 +1029,7 @@ module RDoc::Generators
|
|||||||
HTMLGenerator.gen_url(path, file_path)
|
HTMLGenerator.gen_url(path, file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def HtmlMethod.all_methods
|
def self.all_methods
|
||||||
@@all_methods
|
@@all_methods
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1155,7 +1156,7 @@ module RDoc::Generators
|
|||||||
##
|
##
|
||||||
# Converts a target url to one that is relative to a given path
|
# Converts a target url to one that is relative to a given path
|
||||||
|
|
||||||
def HTMLGenerator.gen_url(path, target)
|
def self.gen_url(path, target)
|
||||||
from = File.dirname(path)
|
from = File.dirname(path)
|
||||||
to, to_file = File.split(target)
|
to, to_file = File.split(target)
|
||||||
|
|
||||||
@ -1178,8 +1179,8 @@ module RDoc::Generators
|
|||||||
# options they are passed. Because of this we create them using a factory
|
# options they are passed. Because of this we create them using a factory
|
||||||
|
|
||||||
def self.for(options)
|
def self.for(options)
|
||||||
AllReferences::reset
|
AllReferences.reset
|
||||||
HtmlMethod::reset
|
HtmlMethod.reset
|
||||||
|
|
||||||
if options.all_one_file
|
if options.all_one_file
|
||||||
HTMLGeneratorInOne.new(options)
|
HTMLGeneratorInOne.new(options)
|
||||||
@ -1270,7 +1271,6 @@ module RDoc::Generators
|
|||||||
# class, module, and method names)
|
# class, module, and method names)
|
||||||
|
|
||||||
def build_indices
|
def build_indices
|
||||||
|
|
||||||
@toplevels.each do |toplevel|
|
@toplevels.each do |toplevel|
|
||||||
@files << HtmlFile.new(toplevel, @options, FILE_DIR)
|
@files << HtmlFile.new(toplevel, @options, FILE_DIR)
|
||||||
end
|
end
|
||||||
@ -1362,17 +1362,23 @@ module RDoc::Generators
|
|||||||
# line.
|
# line.
|
||||||
|
|
||||||
def gen_main_index
|
def gen_main_index
|
||||||
template = RDoc::TemplatePage.new(RDoc::Page::INDEX)
|
template = RDoc::TemplatePage.new RDoc::Page::INDEX
|
||||||
File.open("index.html", "w") do |f|
|
|
||||||
|
open 'index.html', 'w' do |f|
|
||||||
|
classes = @classes.sort.map { |klass| klass.value_hash }
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
"initial_page" => main_url,
|
'main_page' => @main_page,
|
||||||
|
'initial_page' => main_url,
|
||||||
|
'style_url' => style_url('', @options.css),
|
||||||
'title' => CGI.escapeHTML(@options.title),
|
'title' => CGI.escapeHTML(@options.title),
|
||||||
'charset' => @options.charset
|
'charset' => @options.charset,
|
||||||
|
'classes' => classes,
|
||||||
}
|
}
|
||||||
if @options.inline_source
|
|
||||||
values['inline_source'] = true
|
values['inline_source'] = @options.inline_source
|
||||||
end
|
|
||||||
template.write_html_on(f, values)
|
template.write_html_on f, values
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1380,33 +1386,29 @@ module RDoc::Generators
|
|||||||
# Returns the url of the main page
|
# Returns the url of the main page
|
||||||
|
|
||||||
def main_url
|
def main_url
|
||||||
main_page = @options.main_page
|
@main_page = @options.main_page
|
||||||
ref = nil
|
@main_page_ref = nil
|
||||||
if main_page
|
if @main_page
|
||||||
ref = AllReferences[main_page]
|
@main_page_ref = AllReferences[@main_page]
|
||||||
if ref
|
if @main_page_ref then
|
||||||
ref = ref.path
|
@main_page_path = @main_page_ref.path
|
||||||
else
|
else
|
||||||
$stderr.puts "Could not find main page #{main_page}"
|
$stderr.puts "Could not find main page #{@main_page}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless ref
|
unless @main_page_path then
|
||||||
for file in @files
|
file = @files.find { |file| file.document_self }
|
||||||
if file.document_self
|
@main_page_path = file.path if file
|
||||||
ref = file.path
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
unless ref
|
unless @main_page_path then
|
||||||
$stderr.puts "Couldn't find anything to document"
|
$stderr.puts "Couldn't find anything to document"
|
||||||
$stderr.puts "Perhaps you've used :stopdoc: in all classes"
|
$stderr.puts "Perhaps you've used :stopdoc: in all classes"
|
||||||
exit(1)
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
ref
|
@main_page_path
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user