Module: Pandoku::OutputFormat

Included in:
Formats::HTML, Formats::Markdown, Formats::ODT
Defined in:
lib/pandoku/format.rb

Instance Method Summary collapse

Instance Method Details

#compile(document, io = false) ⇒ Object

Compiles the given document to the format. If a second argument io is true, returns IO instead of String.



43
44
45
46
47
48
49
50
51
# File 'lib/pandoku/format.rb', line 43

def compile(document, io = false)
  cin, cout, cerr = Open3.popen3(document.command_for(self))
  cin.print(document.text)
  cin.close
  return cout if io
  result = cout.read
  cout.close
  return result
end