move formatted vs raw into Page

This commit is contained in:
Tom Preston-Werner
2010-04-10 11:29:57 -06:00
parent 8132f4c602
commit c37204e42a
5 changed files with 33 additions and 27 deletions
+17 -3
View File
@@ -23,10 +23,24 @@ module Gollum
self
end
# The contents of the page.
# The on-disk filename of the page.
#
# Returns the String name.
def name
self.blob.name rescue nil
end
# The formatted contents of the page.
#
# Returns the String data.
def data
def formatted_data
GitHub::Markup.render(self.blob.name, self.blob.data) rescue nil
end
# The raw contents of the page.
#
# Returns the String data.
def raw_data
self.blob.data rescue nil
end
@@ -65,7 +79,7 @@ module Gollum
# Returns a Gollum::Page or nil if the page could not be found.
def find(name)
commit = self.wiki.repo.commits.first
content = find_page_in_tree(commit.tree, name)
find_page_in_tree(commit.tree, name)
end
# private
+1 -1
View File
@@ -17,7 +17,7 @@ module Gollum
# name - The human or canonical String page name of the wiki page.
#
# Returns a Gollum::Page or nil if no matching page was found.
def formatted_page(name)
def page(name)
Page.new(self).find(name)
end
end