Sha256: d6d219575b493729bfb0da23948170f9609b7cd5106adeef812054ca3e3b2a3d

Contents?: true

Size: 1 KB

Versions: 33

Compression:

Stored size: 1 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'open-uri'
require 'irb'
require 'uri'
require 'rubygems'
require 'nokogiri'

parse_class = Nokogiri

opts = OptionParser.new do |opts|
  opts.banner = "Nokogiri: an HTML, XML, SAX, and Reader parser"
  opts.define_head "Usage: nokogiri <uri|path> [options]"
  opts.separator ""
  opts.separator "Examples:"
  opts.separator "  nokogiri http://www.ruby-lang.org/"
  opts.separator "  nokogiri ./public/index.html"
  opts.separator ""
  opts.separator "Options:"

  opts.on("--type [TYPE]", [:xml, :html]) do |v|
    parse_class = {:xml => Nokogiri::XML, :html => Nokogiri::HTML}[v]
  end

  opts.on_tail("-?", "--help", "Show this message") do
    puts opts
    exit
  end

  opts.on_tail("-v", "--version", "Show version") do
    require 'yaml'
    puts Nokogiri::VERSION_INFO.to_yaml
    exit
  end
end
opts.parse!

uri = ARGV.shift

if uri.to_s.strip.empty?
  puts opts
  exit 1
end

@doc = parse_class.parse(open(uri).read)

puts "Your document is stored in @doc..."
IRB.start

Version data entries

33 entries across 33 versions & 7 rubygems

Version Path
nokogiri-1.5.0.beta.2 bin/nokogiri
nokogiri-1.5.0.beta.2-java bin/nokogiri
nokogiri-1.4.3.1-java bin/nokogiri
nokogiri-1.4.3.1-x86-mswin32 bin/nokogiri
nokogiri-1.4.3.1-x86-mingw32 bin/nokogiri
nokogiri-1.4.3.1 bin/nokogiri
nokogiri-1.4.3-java bin/nokogiri
nokogiri-1.4.3-x86-mswin32 bin/nokogiri
nokogiri-1.4.3-x86-mingw32 bin/nokogiri
nokogiri-1.4.3 bin/nokogiri
glebm-nokogiri-1.4.2.1 bin/nokogiri
nokogiri-1.5.0.beta.1 bin/nokogiri
nokogiri-1.4.2.1-x86-mswin32 bin/nokogiri
nokogiri-1.4.2.1-x86-mingw32 bin/nokogiri
nokogiri-1.5.0.beta.1-java bin/nokogiri
nokogiri-1.4.2-java bin/nokogiri
nokogiri-1.4.2 bin/nokogiri
rubyjedi-nokogiri_java-1.4.0.20100513161003-java bin/nokogiri
jwagener-nokogiri-1.4.1 bin/nokogiri
revo-nokogiri-1.4.1-java bin/nokogiri