diff --git a/tools/convert_html_encoding.rb b/tools/convert_html_encoding.rb index e55c867196..15adcffed1 100755 --- a/tools/convert_html_encoding.rb +++ b/tools/convert_html_encoding.rb @@ -4,8 +4,12 @@ require 'nkf' require 'fileutils' -src_dir = '../1.9.2.euc' -dst_dir = '../1.9.2.utf8' +if ARGV.size != 2 + $stderr.puts 'Usage: convert_html.rb [src_dir] [dst_dir]' + exit +end +src_dir = ARGV[0] +dst_dir = ARGV[1] if FileTest.exist?(dst_dir) puts dst_dir + ' already exist.' diff --git a/tools/make_index.rb b/tools/make_index.rb index 262a72f2df..5c6b645ce7 100755 --- a/tools/make_index.rb +++ b/tools/make_index.rb @@ -9,17 +9,27 @@ require 'json' require 'yaml' -html_dir = '../1.9.2' +$SCRIPT_PATH = File.expand_path(File.dirname(__FILE__)) + +if ARGV.empty? + $stderr.puts 'Usage: make_index.rb [html_dir]' + exit +end +html_dir = ARGV[0] +if !FileTest.exist?(html_dir) || !FileTest.directory?(html_dir) + $stderr.puts 'Not found: ' + html_dir + exit +end id = 1 recs = [] -items = YAML.load_file('default_index.yml') +items = YAML.load_file($SCRIPT_PATH + '/default_index.yml') Find.find(html_dir) do |file| if file !~ /\/(function|doc)\// && FileTest.file?(file) && File.extname(file) == '.html' html = File.read(file) - item = {:path=>file.gsub(/^\.\.\/1\.9\.2/, ''), :key=>''} + item = {:path=>file.gsub(/^.*1\.[0-9]\.[0-9]/, ''), :key=>''} id += 1 # method @@ -34,6 +44,7 @@ item[:desc] = CGI.unescapeHTML($1.gsub(/<.*?>|"/, '').gsub(/\n/, ' ')) end + # class if html =~ %r{(class|module|object) (.*?)} item[:key] = CGI.unescapeHTML($2)