git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: parse `<header>` as a Div
0794862Albert Krewinkel
src/Text/Pandoc/Readers/HTML.hs+2
@@ -205,6 +205,7 @@ block = ((do
205 | otherwise
205 | otherwise
206 -> pDiv
206 -> pDiv
207 "section" -> pDiv
207 "section" -> pDiv
208+ "header" -> pDiv
208 "main" -> pDiv
209 "main" -> pDiv
209 "figure" -> pFigure
210 "figure" -> pFigure
210 "iframe" -> pIframe
211 "iframe" -> pIframe
@@ -404,6 +405,7 @@ pLineBlock = try $ do
404isDivLike :: Text -> Bool
405isDivLike :: Text -> Bool
405isDivLike "div" = True
406isDivLike "div" = True
406isDivLike "section" = True
407isDivLike "section" = True
408+isDivLike "header" = True
407isDivLike "main" = True
409isDivLike "main" = True
408isDivLike _ = False
410isDivLike _ = False
409
411
test/Tests/Readers/HTML.hs+9−5
@@ -99,11 +99,15 @@ tests = [ testGroup "base tag"
99 plain (codeWith ("",["sample"],[]) "Answer is 42")
99 plain (codeWith ("",["sample"],[]) "Answer is 42")
100 ]
100 ]
101 , testGroup "var"
101 , testGroup "var"
102− [
103− test html "inline var block" $
102+ [ test html "inline var block" $
104− "<var>result</var>" =?>
103+ "<var>result</var>" =?>
105− plain (codeWith ("",["variable"],[]) "result")
104+ plain (codeWith ("",["variable"],[]) "result")
105+ ]
106+ , testGroup "header"
107+ [ test htmlNativeDivs "<header> is parsed as a div" $
108+ "<header id=\"title\">Title</header>" =?>
109+ divWith ("title", mempty, mempty) (plain "Title")
106− ]
110+ ]
107 , askOption $ \(QuickCheckTests numtests) ->
111 , askOption $ \(QuickCheckTests numtests) ->
108 testProperty "Round trip" $
112 testProperty "Round trip" $
109 withMaxSuccess (if QuickCheckTests numtests == defaultValue
113 withMaxSuccess (if QuickCheckTests numtests == defaultValue