fixed syntax error, re-added warning for webservice

This commit is contained in:
Burke Libbey 2010-03-30 14:07:30 -05:00
parent 68b1529714
commit 17eeb9e75f

View File

@ -38,7 +38,7 @@
begin begin
require 'rdiscount' require 'rdiscount'
rescue LoadError => boom rescue LoadError => boom
warn "warn: #{boom}. trying bluecloth" warn "WARNING: #{boom}. Trying bluecloth."
require 'bluecloth' require 'bluecloth'
Markdown = BlueCloth Markdown = BlueCloth
end end
@ -52,10 +52,9 @@ require 'net/http'
# Code is run through [Pygments](http://pygments.org/) for syntax # Code is run through [Pygments](http://pygments.org/) for syntax
# highlighting. If it's not installed, locally, use a webservice. # highlighting. If it's not installed, locally, use a webservice.
# It may be a good idea to warn the user. if `which pygmentize` == ""
# if `which pygmentize` == "" warn "WARNING: Pygments not found. Using webservice."
# puts "Warning: Pygments not found. Using pygments.appspot.com for highlighting" end
# end
#### Public Interface #### Public Interface
@ -167,12 +166,11 @@ class Rocco
# `pygmentize(1)` or <http://pygments.appspot.com> # `pygmentize(1)` or <http://pygments.appspot.com>
code_stream = code_blocks.join("\n\n# DIVIDER\n\n") code_stream = code_blocks.join("\n\n# DIVIDER\n\n")
code_html = if (`which pygmentize` == "")
if `which pygmentize` == "" code_html = highlight_webservice(code_stream)
highlight_webservice(code_stream) else
elsif code_html = highlight_pygmentize(code_stream)
highlight_pygmentize(code_stream) end
end
# Do some post-processing on the pygments output to split things back # Do some post-processing on the pygments output to split things back
# into sections and remove partial `<pre>` blocks. # into sections and remove partial `<pre>` blocks.