Class: Mdoc::PandocWriter
- Defined in:
- lib/mdoc/writer/pandoc_writer.rb
Overview
delegate output to pandoc (assume pandoc in path)
Instance Attribute Summary
Attributes inherited from Writer
Instance Method Summary collapse
Instance Method Details
#default_processors ⇒ Object
20 21 22 23 |
# File 'lib/mdoc/writer/pandoc_writer.rb', line 20 def default_processors %w[smart_code_block expand_link] end |
#out(doc) ⇒ Object
4 5 6 7 |
# File 'lib/mdoc/writer/pandoc_writer.rb', line 4 def out(doc) @tmp_file = doc.out_file ? doc.out_file + '.temp__' : '' Mdoc.opts.no_output ? $stdout : File.new(@tmp_file, 'wb') end |
#process!(doc) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mdoc/writer/pandoc_writer.rb', line 9 def process!(doc) @tilt = Tilt::ERBTemplate.new(Mdoc.find_tpl_file('pandoc.md')) oh = out(doc) oh.write @tilt.render(doc) unless oh == $stdout oh.close `pandoc -o #{doc.out_file} #{@tmp_file}` File.delete @tmp_file end end |