alphabetum/pandoc-ruby — pull request #10 by candlerb (2013-11-20 11:54:34+00:00)
Title: Raise error if pandoc does not return success (requires ruby 1.9.3+)

At the moment if pandoc fails (e.g. you pass invalid options) then pandoc-ruby silently returns an empty string with no indication of the error. This patch detects the return code and raises an error if it is non-zero.

~~~
$ irb20 -Ilib
irb(main):001:0> require 'pandoc-ruby'
=> true
irb(main):002:0> PandocRuby.new("# hello", "badopt").to_html5
RuntimeError: pandoc: unrecognized option `--badopt'
Try pandoc --help for more information.

from /Users/brian/git/pandoc-ruby/lib/pandoc-ruby.rb:219:in `execute'
from /Users/brian/git/pandoc-ruby/lib/pandoc-ruby.rb:201:in `convert_string'
from /Users/brian/git/pandoc-ruby/lib/pandoc-ruby.rb:135:in `convert'
from /Users/brian/git/pandoc-ruby/lib/pandoc-ruby.rb:169:in `block (2 levels) in '
from (irb):2
from /usr/local/bin/irb20:12:in `

'
~~~