Permalink
Browse files

Merge pull request #26 from pda/main_page_classname

Main page can be top-level class e.g. --main ::Widget
  • Loading branch information...
2 parents 4d843de + 1eeb2e7 commit 33ae14e68ab149f18b40f6d9e4a51c76b5830733 @voloko voloko committed Oct 21, 2011
Showing with 7 additions and 8 deletions.
  1. +7 −8 lib/sdoc/generator.rb
View
@@ -366,16 +366,15 @@ def index_path
default = @files.first.path
return default unless @options.main_page
- # Handle attempts to hit class docs directly
+ # Transform class name to file path
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
+ slashed = @options.main_page.sub(/^::/, "").gsub("::", "/")
+ "%s/%s.html" % [ class_dir, slashed ]
+ elsif file = @files.find { |f| f.full_name == @options.main_page }
+ file.path
+ else
+ default
end
-
- # Nothing else worked, so stick with the default
- return default
end
### Create index.html with frameset

0 comments on commit 33ae14e

Please sign in to comment.