Hello
On my production server, the most current pandoc version is not the one in the standard path $ pandoc, but in $ /home/www-data/.local/bin/pandoc.
I managed to set PandocRuby to look at the correct place by setting it like so:
PandocRuby.pandoc_path = '/home/www-data/.local/bin/pandoc'
As I need to do some other stuff in my Rails app using Pandoc, I hoped that I could simply do something like this:
def pandoc_version
matches = `#{PandocRuby.pandoc_path} -v`.match /\bpandoc ((\.?\d+)+)\b/
pandoc_version = matches[1].to_f
end
But this results in:
undefined method `pandoc_path' for PandocRuby:Class
I managed to work around this now using a global variable:
PANDOC_PATH = '/home/www-data/.local/bin/pandoc'
PandocRuby.pandoc_path = PANDOC_PATH
So I can do:
def pandoc_version
matches = `#{PANDOC_PATH} -v`.match /\bpandoc ((\.?\d+)+)\b/
pandoc_version = matches[1].to_f
end
But I'm pretty sure there's an easier way to do this, right?
Hello
On my production server, the most current pandoc version is not the one in the standard path
$ pandoc, but in$ /home/www-data/.local/bin/pandoc.I managed to set
PandocRubyto look at the correct place by setting it like so:As I need to do some other stuff in my Rails app using Pandoc, I hoped that I could simply do something like this:
But this results in:
I managed to work around this now using a global variable:
So I can do:
But I'm pretty sure there's an easier way to do this, right?