Sha256: 3bf9a45e8a2b8f1403ca9f6d6725b93a51cfef8e1df7c3fd7fe3b5d9de9987ef

Contents?: true

Size: 984 Bytes

Versions: 6

Compression:

Stored size: 984 Bytes

Contents

require 'hpricot/htmlinfo'

def Hpricot(input = nil, opts = {}, &blk)
  Hpricot.make(input, opts, &blk)
end

module Hpricot
  # Exception class used for any errors related to deficiencies in the system when
  # handling the character encodings of a document.
  class EncodingError < StandardError; end

  # Hpricot.parse parses <i>input</i> and return a document tree.
  # represented by Hpricot::Doc.
  def Hpricot.parse(input = nil, opts = {}, &blk)
    make(input, opts, &blk)
  end

  # Hpricot::XML parses <i>input</i>, disregarding all the HTML rules
  # and returning a document tree.
  def Hpricot.XML(input = nil, opts = {}, &blk)
    opts.merge! :xml => true
    make(input, opts, &blk)
  end

  # :stopdoc:

  def Hpricot.make(input = nil, opts = {}, &blk)
    if blk
      doc = Hpricot.build(&blk)
      doc.instance_variable_set("@options", opts)
      doc
    else
      Hpricot.scan(input, opts)
    end
  end

  # :startdoc:
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shoesgem-0.1480.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb
shoesgem-0.1469.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb
shoesgem-0.1430.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb
shoesgem-0.1429.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb
shoesgem-0.1428.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb
shoesgem-0.1426.0 shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb