module GitHub::Markup

Constants

VERSION
Version

Public Instance Methods

can_render?(filename) click to toggle source
# File lib/github/markup.rb, line 41
def can_render?(filename)
  !!renderer(filename)
end
command(command, regexp, &block) click to toggle source
# File lib/github/markup.rb, line 33
def command(command, regexp, &block)
  if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}")
    command = file
  end

  markups << CommandImplementation.new(regexp, command, &block)
end
markup(file, pattern, opts = {}, &block) click to toggle source
# File lib/github/markup.rb, line 29
def markup(file, pattern, opts = {}, &block)
  markups << GemImplementation.new(pattern, file, &block)
end
markups() click to toggle source
# File lib/github/markup.rb, line 9
def markups
  @@markups
end
preload!() click to toggle source
# File lib/github/markup.rb, line 13
def preload!
  markups.each do |markup|
    markup.load
  end
end
render(filename, content = nil) click to toggle source
# File lib/github/markup.rb, line 19
def render(filename, content = nil)
  content ||= File.read(filename)

  if impl = renderer(filename)
    impl.render(content)
  else
    content
  end
end
renderer(filename) click to toggle source
# File lib/github/markup.rb, line 45
def renderer(filename)
  markups.find { |impl|
    impl.match?(filename)
  }
end