From db55f7c1b243cbc82c70276c7dfb9c0403e369b0 Mon Sep 17 00:00:00 2001 From: bucklereed Date: Wed, 9 Aug 2017 17:10:12 +0100 Subject: HTML reader: parse
like
. (#3791) * HTML reader: parse
like
. *
closes

and behaves like a block element generally --- test/Tests/Readers/HTML.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/Tests/Readers/HTML.hs b/test/Tests/Readers/HTML.hs index da6298e76..00a8cfc90 100644 --- a/test/Tests/Readers/HTML.hs +++ b/test/Tests/Readers/HTML.hs @@ -11,6 +11,9 @@ import Data.Text (Text) html :: Text -> Pandoc html = purely $ readHtml def +htmlNativeDivs :: Text -> Pandoc +htmlNativeDivs = purely $ readHtml def { readerExtensions = enableExtension Ext_native_divs $ readerExtensions def } + tests :: [TestTree] tests = [ testGroup "base tag" [ test html "simple" $ @@ -36,4 +39,16 @@ tests = [ testGroup "base tag" , test html "xml:lang on " $ "hola" =?> setMeta "lang" (text "es") (doc (plain (text "hola"))) ] + , testGroup "main" + [ test htmlNativeDivs "

becomes
" $ "
hello
" =?> + doc (divWith ("", [], [("role", "main")]) (plain (text "hello"))) + , test htmlNativeDivs "
becomes
" $ "
hello
" =?> + doc (divWith ("", [], [("role", "foobar")]) (plain (text "hello"))) + , test htmlNativeDivs "
has attributes preserved" $ "
hello
" =?> + doc (divWith ("foo", ["bar"], [("role", "main"), ("data-baz", "qux")]) (plain (text "hello"))) + , test htmlNativeDivs "
closes

" $ "

hello

main content
" =?> + doc (para (text "hello") <> divWith ("", [], [("role", "main")]) (plain (text "main content"))) + , test htmlNativeDivs "
followed by text" $ "
main content
non-main content" =?> + doc (divWith ("", [], [("role", "main")]) (plain (text "main content")) <> plain (text "non-main content")) + ] ] -- cgit v1.2.3