forked from sparklemotion/nokogiri
/
html.rb
37 lines (33 loc) · 1.24 KB
/
html.rb
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
require 'nokogiri/html/entity_lookup'
require 'nokogiri/html/document'
require 'nokogiri/html/document_fragment'
require 'nokogiri/html/sax/parser_context'
require 'nokogiri/html/sax/parser'
require 'nokogiri/html/sax/push_parser'
require 'nokogiri/html/element_description'
require 'nokogiri/html/element_description_defaults'
module Nokogiri
class << self
###
# Parse HTML. Convenience method for Nokogiri::HTML::Document.parse
def HTML thing, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block
Nokogiri::HTML::Document.parse(thing, url, encoding, options, &block)
end
end
module HTML
class << self
###
# Parse HTML. Convenience method for Nokogiri::HTML::Document.parse
def parse thing, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block
Document.parse(thing, url, encoding, options, &block)
end
####
# Parse a fragment from +string+ in to a NodeSet.
def fragment string, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block
HTML::DocumentFragment.parse string, encoding, options, &block
end
end
# Instance of Nokogiri::HTML::EntityLookup
NamedCharacters = EntityLookup.new
end
end