Class: Pandocomatic::Processor
- Inherits:
-
Object
- Object
- Pandocomatic::Processor
- Defined in:
- lib/pandocomatic/processor.rb
Overview
Generic class for processors used to preprocess, postproces, setup, and cleanup with external scripts or programs during the conversion process.
For preprocessors and postprocessors it is assumed that the input is the contents of the file to convert and the output the processed input. In the end, the output will be put through pandoc.
Direct Known Subclasses
Class Method Summary collapse
-
.run(script, input) ⇒ String
Run script on input and return captured output.
Class Method Details
.run(script, input) ⇒ String
Run script on input and return captured output
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pandocomatic/processor.rb', line 38 def self.run(script, input) output, error, status = Open3.capture3(script, stdin_data: input) warn error unless error.empty? if status.exitstatus.positive? raise ProcessorError.new(:error_processing_script, StandardError.new(error), [script, input]) end output end |