lib/nesta/models.rb in mars-nesta-0.9.4 vs lib/nesta/models.rb in mars-nesta-0.9.5
- old
+ new
@@ -1,9 +1,10 @@
require "time"
require "rubygems"
require "redcloth"
+require "coderay"
begin
require "redcarpet"
Maruku = Redcarpet
rescue LoadError
require "maruku"
@@ -91,14 +92,20 @@
end
def to_html(scope = nil)
case @format
when :mdown
- Maruku.new(markup).to_html
+ Maruku.new(coderay(markup)).to_html
when :haml
Haml::Engine.new(markup).to_html(scope || Object.new)
when :textile
RedCloth.new(markup).to_html
+ end
+ end
+
+ def coderay(text)
+ text.gsub(/^```\s(\w+?)\s+?(^.*?)^```/m) do
+ CodeRay.scan($2, $1).div(:css => :class)
end
end
def last_modified
@last_modified ||= File.stat(@filename).mtime