Skip to content

Commit

Permalink
Main page can be top-level class e.g. --main ::Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
pda committed Sep 16, 2011
1 parent 0acda6c commit fadc362
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/sdoc/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,19 @@ def index_path
default = @files.first.path
return default unless @options.main_page

# Handle attempts to hit class docs directly
if @options.main_page.include?("::")
return "%s/%s.html" % [class_dir, @options.main_page.gsub("::", "/")]
end
if file = @files.find { |f| f.full_name == @options.main_page }
return file.path
main_page = @options.main_page.dup

# Transform class name to file path
if main_page.include?("::")
slashed = main_page.sub(/^::/, "").gsub("::", "/")
main_page = "%s/%s.html" % [ class_dir, slashed ]
end

# Nothing else worked, so stick with the default
return default
if file = @files.find { |f| f.full_name == main_page }
file.path
else
default
end
end

### Create index.html with frameset
Expand Down

0 comments on commit fadc362

Please sign in to comment.