require 'net/http' require 'time' require 'uri' class App def initialize argv @tsv = argv.first || 'pages.tsv' @srv = 'www.wmo.int' @port = 80 @path = '/pages/prog/www/WIS/wiswiki/tiki-index.php' @tasks = [] end def link title, page return '' if '-' == page ['"', (title || page).gsub(/"/, 'Q'), '":', URI::HTTP.build([nil, @srv, @port, @path, "page=#{page}", nil]).to_s ].join end def loadtab File.open(@tsv, 'r') {|fp| for line in fp lev, page, desc = line.chomp.split(/\t/, 3) lev = lev.to_i next if lev.zero? @tasks.push({:lev => lev, :page => page, :desc => desc}) end } end def checkpage http, page path = [@path, '?page=', page].join resp = http.get(path) unless /\A2/ === resp.code return({:code => resp.code}) end title = if /