git.iko.soy/typeable/pandoc
on 4eff607 help sign in
43 lines 1.1 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.HTML (tests) where
4import Test.Framework
5import Text.Pandoc.Builder
6import Text.Pandoc
7import Tests.Helpers
8import Tests.Arbitrary()
10html :: (ToPandoc a) => a -> String
11html = writeHtmlString 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) -> Test
28(=:) = test html
30tests :: [Test]
31tests = [ testGroup "inline code"
32 [ "basic" =: code "@&" =?> "<code>@&amp;</code>"
33 , "haskell" =: codeWith ("",["haskell"],[]) ">>="
34 =?> "<code class=\"haskell\">&gt;&gt;=</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 ]