fall back to BlueCloth if rdiscount isn't available

This commit is contained in:
Ryan Tomayko 2010-03-09 08:56:01 -08:00
parent 5a544ca5de
commit 606087986e
2 changed files with 16 additions and 3 deletions

View File

@ -11,6 +11,11 @@ rescue LoadError
warn "warn: #$!. trying again with rubygems" warn "warn: #$!. trying again with rubygems"
require 'rubygems' require 'rubygems'
retry retry
else
require 'bluecloth'
Markdown = BlueCloth
$LOADED_FEATURES << 'rdiscount.rb'
retry
end end
when /rocco/ when /rocco/
if !$:.include?(libdir) if !$:.include?(libdir)

View File

@ -30,9 +30,17 @@
#### Prerequisites #### Prerequisites
# The [rdiscount](http://github.com/rtomayko/rdiscount) library is # We'll need a Markdown library. [RDiscount][rd], if we're lucky. Otherwise,
# required for Markdown processing. # issue a warning and fall back on using BlueCloth.
require 'rdiscount' #
# [rd]: http://github.com/rtomayko/rdiscount
begin
require 'rdiscount'
rescue LoadError => boom
warn "warn: #{boom}. trying bluecloth"
require 'bluecloth'
Markdown = BlueCloth
end
# We use [{{ mustache }}](http://defunkt.github.com/mustache/) for # We use [{{ mustache }}](http://defunkt.github.com/mustache/) for
# templating. # templating.