mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Fix Docs::Parse#document? when document has no doctype
This commit is contained in:
parent
56d9398148
commit
d366e14ea7
2 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue