/usr/lib/ruby/1.8/rt/w3m.rb is in librt-ruby1.8 1.0.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/ruby
=begin
w3m.rb
$Id: w3m.rb 597 2005-10-18 21:03:12Z rubikitch $
--- W3M.w3m(url, options='-e')
invoke w3m.
--- W3M.html2txt(htmlstr, options='-e')
convert htmlstr to plain text.
--- W3M.source(url, options='-e')
get the source.
=end
module W3M
module_function
def external_filter (str, prog)
require 'open3'
pipe = Open3.popen3(prog)
pipe[0] .print str
pipe[0] .close
pipe[1] .read
end
private_class_method :external_filter
def w3m(url, option='-e')
open("| w3m -dump #{option} #{url}").readlines.join
end
def html2txt(htmlstr, option='-e')
external_filter(htmlstr, "w3m -dump -T text/html #{option}")
end
def source(url, option='')
open("| w3m -dump_source #{option} #{url}").readlines.join
end
end
if __FILE__ == $0
s = W3M::source('http://www.ruby-lang.org')
#print W3M::html2txt s
end
|