diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 1ec02e7d..af6e164c 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -189,26 +189,16 @@ module Gollum @access.exist? end - # Public: Get the formatted page for a given page name. + # Public: Get the formatted page for a given page name, version, and dir. # # name - The human or canonical String page name of the wiki page. # version - The String version ID to find (default: @ref). - # - # Returns a Gollum::Page or nil if no matching page was found. - def page(name, version = @ref) - @page_class.new(self).find(name, version) - end - - # Public: Get the formatted page for a given page name scoped to a - # directory. - # - # name - The human or canonical String page name of the wiki page. # dir - The directory String relative to the repo. - # version - The String version ID to find (default: @ref). # # Returns a Gollum::Page or nil if no matching page was found. - def scoped_page(name, dir, version = @ref) - @page_class.new(self).find(name, version || @ref, dir) + def page(name, version = @ref, dir = nil) + version = @ref if version.nil? + @page_class.new(self).find(name, version, dir) end # Public: Get the static file for a given name. diff --git a/test/test_wiki.rb b/test/test_wiki.rb index 3fb7833c..7e68ab16 100644 --- a/test/test_wiki.rb +++ b/test/test_wiki.rb @@ -104,8 +104,8 @@ context "Wiki" do index.add('Foobar/Elrond.md', 'Baz') index.commit 'Add Foobar/Elrond.', [wiki.repo.commits.last], Grit::Actor.new('Tom Preston-Werner', 'tom@github.com') - assert_equal 'Rivendell/Elrond.md', wiki.scoped_page('Elrond', 'Rivendell').path - assert_equal 'Foobar/Elrond.md', wiki.scoped_page('Elrond', 'Foobar').path + assert_equal 'Rivendell/Elrond.md', wiki.page('Elrond', nil, 'Rivendell').path + assert_equal 'Foobar/Elrond.md', wiki.page('Elrond', nil, 'Foobar').path ensure FileUtils.rm_rf(@path) end