module GitHub::Markup
def can_render?(filename)
def can_render?(filename) !!renderer(filename) end
def command(command, regexp, &block)
def command(command, regexp, &block) if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end markups << CommandImplementation.new(regexp, command, &block) end
def markup(file, pattern, opts = {}, &block)
def markup(file, pattern, opts = {}, &block) markups << GemImplementation.new(pattern, file, &block) end
def markups
def markups @@markups end
def preload!
def preload! markups.each do |markup| markup.load end end
def render(filename, content = nil)
def render(filename, content = nil) content ||= File.read(filename) if impl = renderer(filename) impl.render(content) else content end end
def renderer(filename)
def renderer(filename) markups.find { |impl| impl.match?(filename) } end