2013-01-23 08:47:43 -08:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2011-01-29 16:26:00 -08:00
|
|
|
module Tests.Writers.HTML (tests) where
|
|
|
|
|
|
|
|
import Test.Framework
|
|
|
|
import Text.Pandoc.Builder
|
|
|
|
import Text.Pandoc
|
|
|
|
import Tests.Helpers
|
2016-10-14 08:45:36 -04:00
|
|
|
import Text.Pandoc.Arbitrary()
|
2011-01-29 16:26:00 -08:00
|
|
|
|
2016-07-14 08:54:06 -07:00
|
|
|
html :: (ToPandoc a) => a -> String
|
2016-11-27 11:52:42 +01:00
|
|
|
html = purely (writeHtmlString def{ writerWrapText = WrapNone }) . toPandoc
|
2011-01-29 16:26:00 -08:00
|
|
|
|
|
|
|
{-
|
|
|
|
"my test" =: X =?> Y
|
|
|
|
|
|
|
|
is shorthand for
|
|
|
|
|
|
|
|
test html "my test" $ X =?> Y
|
|
|
|
|
|
|
|
which is in turn shorthand for
|
|
|
|
|
|
|
|
test html "my test" (X,Y)
|
|
|
|
-}
|
|
|
|
|
2012-02-05 13:23:06 -08:00
|
|
|
infix 4 =:
|
2011-01-29 16:26:00 -08:00
|
|
|
(=:) :: (ToString a, ToPandoc a)
|
|
|
|
=> String -> (a, String) -> Test
|
|
|
|
(=:) = test html
|
|
|
|
|
|
|
|
tests :: [Test]
|
|
|
|
tests = [ testGroup "inline code"
|
|
|
|
[ "basic" =: code "@&" =?> "<code>@&</code>"
|
|
|
|
, "haskell" =: codeWith ("",["haskell"],[]) ">>="
|
2013-07-13 13:47:09 -07:00
|
|
|
=?> "<code class=\"haskell\">>>=</code>"
|
2011-01-29 16:26:00 -08:00
|
|
|
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
|
|
|
|
=?> "<code class=\"nolanguage\">>>=</code>"
|
|
|
|
]
|
2011-02-05 08:16:34 -08:00
|
|
|
, testGroup "images"
|
|
|
|
[ "alt with formatting" =:
|
2011-12-13 14:29:07 -08:00
|
|
|
image "/url" "title" ("my " <> emph "image")
|
2011-02-05 08:16:34 -08:00
|
|
|
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
|
|
|
|
]
|
2011-01-29 16:26:00 -08:00
|
|
|
]
|