lib/wrongdoc/merge.rb in wrongdoc-1.0.0 vs lib/wrongdoc/merge.rb in wrongdoc-1.0.1
- old
+ new
@@ -1,18 +1,18 @@
class Wrongdoc::Merge
include Wrongdoc::ParseXML
def initialize(opts)
- @merge_html = opts[:merge_html]
+ @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))
+ src = Nokogiri::XML.fragment(File.read(source))
File.open(rdoc_html, "a+") { |fp|
doc = parse_xml(fp.read)
- doc.search("div#documentation")[0].add_child(src.root)
+ doc.search("div#documentation")[0].add_child(src)
fp.truncate 0
fp.write doc.to_xhtml
}
end
end