git.iko.soy/typeable/pandoc
on fe3d8ea help sign in
46 lines 1.4 kB history raw
1{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
2module Tests.Writers.HTML (tests) where
4import Test.Framework
5import Text.Pandoc.Builder
6import Text.Pandoc
7import Tests.Helpers
8import Tests.Arbitrary()
9import Text.Pandoc.Highlighting (languages) -- null if no hl support
11html :: (ToString a, ToPandoc a) => a -> String
12html = writeHtmlString defaultWriterOptions{ writerWrapText = False } . toPandoc
14{-
15 "my test" =: X =?> Y
17is shorthand for
19 test html "my test" $ X =?> Y
21which is in turn shorthand for
23 test html "my test" (X,Y)
24-}
26infix 4 =:
27(=:) :: (ToString a, ToPandoc a)
28 => String -> (a, String) -> Test
29(=:) = test html
31tests :: [Test]
32tests = [ testGroup "inline code"
33 [ "basic" =: code "@&" =?> "<code>@&amp;</code>"
34 , "haskell" =: codeWith ("",["haskell"],[]) ">>="
35 =?> if null languages
36 then "<code class=\"haskell\">&gt;&gt;=</code>"
37 else "<code class=\"sourceCode haskell\"><span class=\"fu\">&gt;&gt;=</span></code>"
38 , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
39 =?> "<code class=\"nolanguage\">&gt;&gt;=</code>"
40 ]
41 , testGroup "images"
42 [ "alt with formatting" =:
43 image "/url" "title" ("my " <> emph "image")
44 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
45 ]
46 ]