Fix page lookup. #473
This commit is contained in:
@@ -441,13 +441,16 @@ module Gollum
|
|||||||
# Find a page from a given cname. If the page has an anchor (#) and has
|
# Find a page from a given cname. If the page has an anchor (#) and has
|
||||||
# no match, strip the anchor and try again.
|
# no match, strip the anchor and try again.
|
||||||
#
|
#
|
||||||
# cname - The String canonical page name.
|
# cname - The String canonical page name including path.
|
||||||
#
|
#
|
||||||
# Returns a Gollum::Page instance if a page is found, or an Array of
|
# Returns a Gollum::Page instance if a page is found, or an Array of
|
||||||
# [Gollum::Page, String extra] if a page without the extra anchor data
|
# [Gollum::Page, String extra] if a page without the extra anchor data
|
||||||
# is found.
|
# is found.
|
||||||
def find_page_from_name(cname)
|
def find_page_from_name(cname)
|
||||||
if page = @wiki.page(cname)
|
slash = cname.rindex('/')
|
||||||
|
name = cname[slash+1..-1]
|
||||||
|
path = cname[0..slash]
|
||||||
|
if page = @wiki.paged(name, path)
|
||||||
return page
|
return page
|
||||||
end
|
end
|
||||||
if pos = cname.index('#')
|
if pos = cname.index('#')
|
||||||
|
|||||||
Reference in New Issue
Block a user