From cc929bbc56f58d55709a79c3252b4440781a5639 Mon Sep 17 00:00:00 2001 From: rick Date: Thu, 30 Sep 2010 15:36:14 -0700 Subject: [PATCH] tomdoc'd --- lib/gollum/markup.rb | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index b1010138..d7cdd5c4 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -279,15 +279,6 @@ module Gollum end end - def find_page_from_name(cname) - if page = @wiki.page(cname) - return page - end - if pos = cname.index('#') - [@wiki.page(cname[0...pos]), cname[pos..-1]] - end - end - # Find the given file in the repo. # # name - The String absolute or relative path of the file. @@ -302,6 +293,23 @@ module Gollum end end + # Find a page from a given cname. If the page has an anchor (#) and has + # no match, strip the anchor and try again. + # + # cname - The String canonical page name. + # + # 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 + # is found. + def find_page_from_name(cname) + if page = @wiki.page(cname) + return page + end + if pos = cname.index('#') + [@wiki.page(cname[0...pos]), cname[pos..-1]] + end + end + ######################################################################### # # Code