make markup take page as the param

This commit is contained in:
Tom Preston-Werner
2010-04-18 11:41:24 -07:00
parent 37ef17f047
commit 2b20054d5c
3 changed files with 28 additions and 10 deletions
+9 -7
View File
@@ -4,13 +4,12 @@ module Gollum
class Markup
# Initialize a new Markup object.
#
# name - The String filename of the page.
# data - The String contents of the page.
# page - The Gollum::Page.
#
# Returns a new Gollum::Markup object, ready for rendering.
def initialize(name, data)
@name = name
@data = data
def initialize(page)
@name = page.name
@data = page.raw_data
@tagmap = {}
end
@@ -72,6 +71,9 @@ module Gollum
# Returns the String HTML if the tag is a valid image tag or nil
# if it is not.
def process_image_tag(tag)
parts = tag.split('|')
name = parts[0].strip
nil
end
@@ -93,8 +95,8 @@ module Gollum
# if it is not.
def process_page_link_tag(tag)
parts = tag.split('|')
name = parts[0]
cname = Gollum::canonical_name(parts[1] || parts[0])
name = parts[0].strip
cname = Gollum::canonical_name((parts[1] || parts[0]).strip)
%{<a href="#{cname}">#{name}</a>}
end
end
+1 -1
View File
@@ -35,7 +35,7 @@ module Gollum
#
# Returns the String data.
def formatted_data
Gollum::Markup.new(@blob.name, @blob.data).render rescue nil
Gollum::Markup.new(self).render rescue nil
end
# Public: The format of the page.