lib/hyde/page_factory.rb in hydeweb-0.0.4 vs lib/hyde/page_factory.rb in hydeweb-0.0.5
- old
+ new
@@ -1,13 +1,16 @@
module Hyde
class PageFactory
def self.create(path, project, def_page_class = Page)
+ ext = File.extname(path)
begin
do_create path, project, def_page_class
rescue NotFound
- do_create "#{path}/index.html".squeeze('/'), project, def_page_class
- rescue NotFound => e
- raise e
+ begin
+ do_create "#{path.chomp(ext)}", project, def_page_class
+ rescue NotFound
+ do_create "#{path}/index.html".squeeze('/'), project, def_page_class
+ end
end
end
def self.do_create(path, project, def_page_class = Page)
info = get_page_info(path, project, def_page_class)