@@ -0,0 +1,52 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Tests.Writers.Docbook (tests) where
3+
4+import Test.Framework
5+import Text.Pandoc.Builder
6+import Text.Pandoc
7+import Tests.Helpers
8+import Tests.Arbitrary()
9+
10+docbook :: (ToString a, ToPandoc a) => a -> String
11+docbook = writeDocbook def{ writerWrapText = False } . toPandoc
12+
13+{-
14+ "my test" =: X =?> Y
15+
16+is shorthand for
17+
18+ test docbook "my test" $ X =?> Y
19+
20+which is in turn shorthand for
21+
22+ test docbook "my test" (X,Y)
23+-}
24+
25+infix 4 =:
26+(=:) :: (ToString a, ToPandoc a)
27+ => String -> (a, String) -> Test
28+(=:) = test docbook
29+
30+lineblock :: Blocks
31+lineblock = para ("some text" <> linebreak <>
32+ "and more lines" <> linebreak <>
33+ "and again")
34+lineblock_out :: String
35+lineblock_out = "<literallayout>some text\n" ++
36+ "and more lines\n" ++
37+ "and again</literallayout>"
38+
39+tests :: [Test]
40+tests = [ testGroup "line blocks"
41+ [ "none" =: para "This is a test"
42+ =?> "<para>\n This is a test\n</para>"
43+ , "basic" =: lineblock
44+ =?> lineblock_out
45+ , "blockquote" =: blockQuote lineblock
46+ =?> ("<blockquote>\n" ++ lineblock_out ++ "\n</blockquote>")
47+ , "footnote" =: para ("This is a test" <> note lineblock <> " of footnotes")
48+ =?> ("<para>\n This is a test<footnote>\n" ++
49+ lineblock_out ++
50+ "\n </footnote> of footnotes\n</para>")
51+ ]
52+ ]