#!/usr/local/bin/ruby -s
=begin
html2text.rb
Application for html2text.rb
Copyright (C) 2001 Masaharu FUJITA
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You may contact the author by:
e-mail: fujita@a2z.co.jp
url: http://www.a2z.co.jp/~fujita/Ruby/get_html_table.rb
=end
require "get_html_table"
require "ght_format.rb"
if $help != nil
print "usage: #$0 -help -type=[type] -url=[url] -print\n"
exit
end
FirstEval.each do |cmd|
eval(cmd)
end
if $url == nil
@html_string = $stdin.readlines
table = GetTableText.new(@html_string)
else
html = GetHtmlFile.new($url)
html.get_html
table = GetTableText.new(html.html_string)
end
table.get_html_body
table.get_text
if $print != nil
table.print_index_text
exit
end
@table = table.table
Type.each do |data|
if $type == data[0]
data[1].each do |cmd|
eval(cmd)
end
break
end
end