# File lib/asciidoctor/document.rb, line 1065
  def write output, target
    if Writer === @converter
      @converter.write output, target
    else
      if target.respond_to? :write
        unless output.nil_or_empty?
          target.write output.chomp
          # ensure there's a trailing endline
          target.write EOL
        end
      else
        ::File.open(target, 'w') {|f| f.write output }
      end
      nil
    end
  end