require 'web/sgml-parser'

class JF_PARSER < SGMLParser

  attr_reader :links, :frames
  def initialize
    super
    @links=[]
    @frames=[]
  end


  def handle_data(data)
    @link << data if @link
  end

  def start_a(attrs)
  #attrs.each{|key,val| puts key+'->'+val}
    if href=attrs.assoc('href')
      @addr= href[1].gsub(/"|'/,'')
      @link=''
    end
  end

  def end_a
    if @link
#  puts @link+'->'+@addr
      @links << [@link,@addr]
      @link=nil
    end
  end



=begin
  def do_frame(attrs)
    if src= attrs.assoc('src')
      @frames << src[1].gsub(/"|'/,'')
    end
  end
=end

end
