Skip to content

Instantly share code, notes, and snippets.

@junaruga
Created May 14, 2016 22:45
Show Gist options
  • Select an option

  • Save junaruga/65d0ab59f1bede2d6047ce4002e390f6 to your computer and use it in GitHub Desktop.

Select an option

Save junaruga/65d0ab59f1bede2d6047ce4002e390f6 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'nokogiri'
puts Nokogiri::VERSION
module Nokogiri
module HTML
class Document < Nokogiri::XML::Document
class << self
def test_for_parse
expect = <<'EOS'
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>b</body></html>
EOS
html = '<<a>b'
doc = read_memory("<html><body>#{html}", nil, "UTF-8", 2145)
puts doc.to_s
p(doc.to_s == expect)
end
end
end
end
end
Nokogiri::HTML::Document.test_for_parse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment