Sha256: 1ce20eef1cf6e5c7db81829a0add4d0cb0a2939de8a879a54ac6f7725b59356f

Contents?: true

Size: 477 Bytes

Versions: 3

Compression:

Stored size: 477 Bytes

Contents

require 'tilt/erb'

module Mdoc
  class Writer
    attr_accessor :tilt

    def out(doc)
      Mdoc.opts.no_output ? $stdout : File.new(doc.out_file, 'wb')
    end

    def process!(doc)
      @tilt = Tilt::ERBTemplate.new(doc.tpl_file)
      oh = out(doc)
      oh.write @tilt.render(doc)
      oh.close unless oh == $stdout
    end

    def default_processors
      %w[
        add_toc
        add_title
        smart_code_block
        expand_link
      ]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mdoc-0.0.11 lib/mdoc/writer.rb
mdoc-0.0.10 lib/mdoc/writer.rb
mdoc-0.0.9 lib/mdoc/writer.rb