Merge pull request #1190 from mojombo/maruku-errors
Fail loudly on MaRuKu errors (exit code other than 0).
This commit is contained in:
commit
ae4da46ea1
|
@ -5,12 +5,9 @@ module Jekyll
|
||||||
def initialize(config)
|
def initialize(config)
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
@config = config
|
@config = config
|
||||||
if @config['maruku']['use_divs']
|
@errors = []
|
||||||
load_divs_library
|
load_divs_library if @config['maruku']['use_divs']
|
||||||
end
|
load_blahtext_library if @config['maruku']['use_tex']
|
||||||
if @config['maruku']['use_tex']
|
|
||||||
load_blahtext_library
|
|
||||||
end
|
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||||
STDERR.puts ' $ [sudo] gem install maruku'
|
STDERR.puts ' $ [sudo] gem install maruku'
|
||||||
|
@ -38,8 +35,15 @@ module Jekyll
|
||||||
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
|
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_errors_and_fail
|
||||||
|
print @errors.join
|
||||||
|
raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
|
||||||
|
end
|
||||||
|
|
||||||
def convert(content)
|
def convert(content)
|
||||||
Maruku.new(content).to_html
|
converted = Maruku.new(content, :error_stream => @errors).to_html
|
||||||
|
print_errors_and_fail unless @errors.empty?
|
||||||
|
converted
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue