Skip to content

Commit

Permalink
Allow --main to contain class names
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerdmaster committed Sep 3, 2011
1 parent 3359687 commit b5ca84f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/sdoc/generator.rb
Expand Up @@ -355,20 +355,29 @@ def generate_file_files
end
end

def index_file
if @options.main_page && file = @files.find { |f| f.full_name == @options.main_page }
file
else
@files.first
### Determines index path based on @options.main_page (or lack thereof)
def index_path
# Break early to avoid a big if block when no main page is specified
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
end

# Nothing else worked, so stick with the default
return default
end

### Create index.html with frameset
def generate_index_file
debug_msg "Generating index file in #@outputdir"
templatefile = @template_dir + 'index.rhtml'
outfile = @outputdir + 'index.html'
index_path = index_file.path

self.render_template( templatefile, binding(), outfile )
end
Expand Down

0 comments on commit b5ca84f

Please sign in to comment.