-
-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
How about something like
def Pandoc.convert_file(inputfile, outputfile, *kwargs, **options)
# use it like Pandoc.convert_file(myinputfile.md, myoutputfile.pdf, '--pdf-engine pdfroff', from: 'markdown')
target = options[:to].present? ? options[:to] : outputfile.split('.')[-1] # only needed if file extension != name of output type
source = options[:from].present? ? options[:from] : inputfile.split('.')[-1] # only needed if file extension != name of input type
if kwargs.empty?
return PandocRuby.new([inputfile], '-s', options, from: source, o: outputfile).send("to_#{target}")
elsif options.empty?
PandocRuby.new([inputfile], kwargs, '-s', from: source, o: outputfile).send("to_#{target}")
else
PandocRuby.new([inputfile], kwargs, '-s', options, from: source, o: outputfile).send("to_#{target}")
end
end
to directly convert from file to file without the kwargs (as far as that is possible)? This code is very elementary and probably won't work in many cases, but it's the first thing I wrote to integrate PandocRuby better with my code.
Metadata
Metadata
Assignees
Labels
No labels