wrongdoc.git  about / heads / tags
RDoc done right (IMNSHO)
blob 7c9589c21005ebd31c07a6d56d23469c6bea1e4d 473 bytes (raw)
$ git show HEAD:lib/wrongdoc/merge.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 
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.fragment(File.read(source))
      File.open(rdoc_html, "a+") { |fp|
        doc = parse_xml(fp.read)
        doc.search("div#documentation")[0].add_child(src)
        fp.truncate 0
        fp.write doc.to_xhtml
      }
    end
  end
end

git clone https://yhbt.net/wrongdoc.git