use initialize/render flow for markup

This commit is contained in:
Tom Preston-Werner
2010-04-18 09:53:35 -07:00
parent 9d29ec6485
commit d78e2d200b
2 changed files with 21 additions and 5 deletions
+20 -4
View File
@@ -1,14 +1,30 @@
module Gollum
class Markup
# Render the content with Gollum wiki syntax on top of the file's own
# markup language.
# Initialize a new Markup object.
#
# name - The String filename of the page.
# data - The String contents of the page.
#
# Returns a new Gollum::Markup object, ready for rendering.
def initialize(name, data)
@name = name
@data = data
@tagmap = {}
end
# Render the content with Gollum wiki syntax on top of the file's own
# markup language.
#
# Returns the formatted String content.
def self.render(name, data)
GitHub::Markup.render(name, data) rescue nil
def render
base_markup = GitHub::Markup.render(@name, @data) rescue nil
end
# Extract all tags into the tagmap and replace with placeholders.
#
# Returns nothing.
def extract_tags
end
end
end
+1 -1
View File
@@ -35,7 +35,7 @@ module Gollum
#
# Returns the String data.
def formatted_data
Gollum::Markup.render(@blob.name, @blob.data) rescue nil
Gollum::Markup.new(@blob.name, @blob.data).render rescue nil
end
# Public: The format of the page.