Make wiki.page directory aware.
Remove scoped_page.
This commit is contained in:
+4
-14
@@ -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.
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user