all repos — markup @ 819fa6024eaf2e5fe4854c81cf1d5834a793f113

The code we use to render README.your_favorite_markup

add a markups accessor method for @@markups
Charlie Somerville charlie@charliesomerville.com
Wed, 04 Dec 2013 12:01:13 +1100
commit

819fa6024eaf2e5fe4854c81cf1d5834a793f113

parent

606dfa12397db75c61a4c7f971c91c49380af011

2 files changed, 9 insertions(+), 5 deletions(-)

jump to
M lib/github/markup.rblib/github/markup.rb

@@ -6,8 +6,12 @@ module Markup

extend self @@markups = [] + def markups + @@markups + end + def preload! - @@markups.each do |markup| + markups.each do |markup| markup.load end end

@@ -23,7 +27,7 @@ end

end def markup(file, pattern, opts = {}, &block) - @@markups << GemImplementation.new(pattern, file, &block) + markups << GemImplementation.new(pattern, file, &block) end def command(command, regexp, &block)

@@ -31,7 +35,7 @@ if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}")

command = file end - @@markups << CommandImplementation.new(regexp, command, &block) + markups << CommandImplementation.new(regexp, command, &block) end def can_render?(filename)

@@ -39,7 +43,7 @@ !!renderer(filename)

end def renderer(filename) - @@markups.find { |impl| + markups.find { |impl| impl.match?(filename) } end
M lib/github/markups.rblib/github/markups.rb

@@ -1,6 +1,6 @@

require "github/markup/markdown" -@@markups << GitHub::Markup::Markdown.new +markups << GitHub::Markup::Markdown.new markup(:redcloth, /textile/) do |content| RedCloth.new(content).to_html