module W3M

w3m.rb $Id: w3m.rb 597 2005-10-18 21:03:12Z rubikitch $

Public Instance Methods

external_filter(str, prog) click to toggle source
# File lib/rt/w3m.rb, line 17
def external_filter (str, prog)
  require 'open3'

  pipe = Open3.popen3(prog)
  pipe[0] .print str
  pipe[0] .close
  pipe[1] .read
end
html2txt(htmlstr, option='-e') click to toggle source
# File lib/rt/w3m.rb, line 31
def html2txt(htmlstr, option='-e')
  external_filter(htmlstr, "w3m -dump -T text/html #{option}")
end
source(url, option='') click to toggle source
# File lib/rt/w3m.rb, line 35
def source(url, option='')
  open("| w3m -dump_source #{option} #{url}").readlines.join
end
w3m(url, option='-e') click to toggle source
# File lib/rt/w3m.rb, line 27
def w3m(url, option='-e')
  open("| w3m -dump #{option} #{url}").readlines.join
end