Fix Docs::Parse#document? when document has no doctype

This commit is contained in:
Thibaut Courouble 2016-04-10 10:16:24 -04:00
parent 56d9398148
commit d366e14ea7
2 changed files with 4 additions and 1 deletions

View file

@ -11,7 +11,7 @@ module Docs
private
def document?
@content =~ /\A\s*<!doctype/i
@content =~ /\A\s*<(?:\!doctype|html)/i
end
def parse_as_document

View file

@ -22,6 +22,9 @@ class DocsParserTest < MiniTest::Spec
it "returns the <body>" do
body = '<!doctype html><meta charset=utf-8><title></title><div>Test</div>'
assert_equal '<div>Test</div>', parser(body).html.inner_html
body = '<html><meta charset=utf-8><title></title><div>Test</div></html>'
assert_equal '<div>Test</div>', parser(body).html.inner_html
end
end
end