class Wrongdoc::Merge include Wrongdoc::ParseXML def initialize(opts) @merge_html = opts[:merge_html] end def run @merge_html.each do |file, source| rdoc_html = "doc/#{file}.html" src = Nokogiri::XML(File.read(source)) File.open(rdoc_html, "a+") { |fp| doc = parse_xml(fp.read) doc.search("div#documentation")[0].add_child(src.root) fp.truncate 0 fp.write doc.to_xhtml } end end end