HTML writer: parse <header> as a Div

HTML5 `<header>` elements are treated like `<div>` elements.
This commit is contained in:
Albert Krewinkel 2021-05-15 16:36:13 +02:00
parent 46baf6659d
commit 0794862aac
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 11 additions and 5 deletions

View file

@ -205,6 +205,7 @@ block = ((do
| otherwise
-> pDiv
"section" -> pDiv
"header" -> pDiv
"main" -> pDiv
"figure" -> pFigure
"iframe" -> pIframe
@ -404,6 +405,7 @@ pLineBlock = try $ do
isDivLike :: Text -> Bool
isDivLike "div" = True
isDivLike "section" = True
isDivLike "header" = True
isDivLike "main" = True
isDivLike _ = False

View file

@ -99,11 +99,15 @@ tests = [ testGroup "base tag"
plain (codeWith ("",["sample"],[]) "Answer is 42")
]
, testGroup "var"
[
test html "inline var block" $
"<var>result</var>" =?>
plain (codeWith ("",["variable"],[]) "result")
]
[ test html "inline var block" $
"<var>result</var>" =?>
plain (codeWith ("",["variable"],[]) "result")
]
, testGroup "header"
[ test htmlNativeDivs "<header> is parsed as a div" $
"<header id=\"title\">Title</header>" =?>
divWith ("title", mempty, mempty) (plain "Title")
]
, askOption $ \(QuickCheckTests numtests) ->
testProperty "Round trip" $
withMaxSuccess (if QuickCheckTests numtests == defaultValue