module Nokogiri

def HTML thing, url = nil, encoding = nil, options = 2145

Nokogiri::XML.
Nokogiri::XML::PARSE_RECOVER. See the constants in
is a number that sets options in the parser, such as
encoding that should be used when processing the document. +options+
+url+ is resource where this document is located. +encoding+ is the
responds to _read_ and _close_ such as an IO, or StringIO.
Parse HTML. +thing+ may be a String, or any object that
##
def HTML thing, url = nil, encoding = nil, options = 2145
  Nokogiri::HTML.parse(thing, url, encoding, options)
end

def Hpricot(*args, &block)

def Hpricot(*args, &block)
  if block_given?
    builder = Nokogiri::HTML::Builder.new(&block)
    Nokogiri::Hpricot.add_decorators(builder.doc)
  else
    doc = Nokogiri.parse(*args)
    Nokogiri::Hpricot.add_decorators(doc)
  end
end

def Slop(*args, &block)


assert_equal('second', doc.html.body.p[1].text)
eohtml


second


first




doc = Nokogiri::Slop(<<-eohtml)

or XPath. For example:
implements method_missing such that methods may be used instead of CSS
Parse a document and add the Slop decorator. The Slop decorator
##
def Slop(*args, &block)
  Nokogiri(*args, &block).slop!
end

def XML thing, url = nil, encoding = nil, options = 1

Nokogiri::XML.
Nokogiri::XML::PARSE_RECOVER. See the constants in
is a number that sets options in the parser, such as
encoding that should be used when processing the document. +options+
+url+ is resource where this document is located. +encoding+ is the
responds to _read_ and _close_ such as an IO, or StringIO.
Parse an XML file. +thing+ may be a String, or any object that
##
def XML thing, url = nil, encoding = nil, options = 1
  Nokogiri::XML.parse(thing, url, encoding, options)
end

def make input = nil, opts = {}, &blk

def make input = nil, opts = {}, &blk
  if input
    Nokogiri::HTML.fragment(input).children.first
  else
    Nokogiri(&blk)
  end
end

def parse string, url = nil, encoding = nil, options = nil

Parse an HTML or XML document. +string+ contains the document.
##
def parse string, url = nil, encoding = nil, options = nil
  doc =
    if string =~ /^\s*<[^Hh>]*html/i # Probably html
      Nokogiri::HTML.parse(string, url, encoding, options || 2145)
    else
      Nokogiri::XML.parse(string, url, encoding, options || 2159)
    end
  yield doc if block_given?
  doc
end