git.iko.soy/typeable/pandoc
on 34412cf help sign in
43 lines 1.2 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.HTML (tests) where
4import Test.Tasty
5import Tests.Helpers
6import Text.Pandoc
7import Text.Pandoc.Arbitrary ()
8import Text.Pandoc.Builder
10html :: (ToPandoc a) => a -> String
11html = purely (writeHtml4String def{ writerWrapText = WrapNone }) . toPandoc
13{-
14 "my test" =: X =?> Y
16is shorthand for
18 test html "my test" $ X =?> Y
20which is in turn shorthand for
22 test html "my test" (X,Y)
23-}
25infix 4 =:
26(=:) :: (ToString a, ToPandoc a)
27 => String -> (a, String) -> TestTree
28(=:) = test html
30tests :: [TestTree]
31tests = [ testGroup "inline code"
32 [ "basic" =: code "@&" =?> "<code>@&amp;</code>"
33 , "haskell" =: codeWith ("",["haskell"],[]) ">>="
34 =?> "<code class=\"sourceCode haskell\"><span class=\"fu\">&gt;&gt;=</span></code>"
35 , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
36 =?> "<code class=\"nolanguage\">&gt;&gt;=</code>"
37 ]
38 , testGroup "images"
39 [ "alt with formatting" =:
40 image "/url" "title" ("my " <> emph "image")
41 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
42 ]
43 ]