=begin *使い方 wxruby-doc-???.zip or .tar.gzを展開 doc/ +html/ +aboutdialoginfo.html ... +wxruby2chm.rb <- このファイルをここにコピー HtmlHelpWorkshopのhhc.exeへパスを通しておいてwxruby2chm.rbを実行 しばらくするとwxruby2.chmができあがり =end $Classes = [] $Methods = [] def scanIndex(html) state = :search IO.readlines(html).each{|x| case state when :search case x when /
/ state = :store when /

(Wx::.+)<\/h1>/ $Classes << [html, $2.strip, $1.strip] $Methods << [html, $2.strip, ''] end when :store case x when /href="(#[^ ]+)">([^"]+)<\/a>/ $Methods << [html, $2.strip, $1.strip] when /<\/div>/ break end end } end $Files = [] base = 'html' Dir.open(base).each{|f| next if f =~ /^\./ $Files << base+"\\"+f next unless f =~ /\.html$/i scanIndex(base+"/"+f) } #---------------------------------------------------------- # mkHHP puts 'Generating wxruby2.hhp' topfile = 'html\\index.html' open('wxruby2.hhp','w'){|f| f.puts "[OPTIONS] Compatibility=1.1 or later Language=0x411 日本語 Full-text search=Yes Display compile progress=No Compiled file=wxruby2.chm Contents file=wxruby2.hhc Index file=wxruby2.hhk Title=wxRuby2 Default topic=#{topfile.gsub('\\','\\\\')} [FILES] "+topfile $Files.each{|x| f.puts x if x != topfile } } #---------------------------------------------------------- # mkHHK puts 'Generating wxruby2.hhk' def putItem(f, x) fmt = '
  • ' f.printf(fmt, x[1].gsub(/^Wx::/,''), x[0]+x[2]) end open('wxruby2.hhk','w'){|f| f.puts '
      ' $Methods.each{|x| putItem(f, x) } f.puts '
    ' } #---------------------------------------------------------- # mkHHC puts 'Generating wxruby2.hhc' def putHhcItem(f, x) fmt = '
  • ' f.printf(fmt, x[1], x[0]) end open('wxruby2.hhc','w'){|o| o.puts '
      • ' $Classes.each{|x| putHhcItem(o, x) } o.puts '
    ' } #---------------------------------------------------------- puts "hhc wxruby2.hhp" `hhc wxruby2.hhp`