diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
commit | fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f (patch) | |
tree | 448a3c909200e8bbd45ecaa65f2f85d88bcc66c6 /tests | |
parent | ac312caabd8c4e595e0b930154fd3033ba397ace (diff) |
Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate. Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated. [API change]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Tests/Helpers.hs | 6 | ||||
-rw-r--r-- | tests/Tests/Readers/Docx.hs | 6 | ||||
-rw-r--r-- | tests/Tests/Readers/Odt.hs | 6 | ||||
-rw-r--r-- | tests/Tests/Writers/Native.hs | 2 | ||||
-rw-r--r-- | tests/Tests/Writers/RST.hs | 6 |
5 files changed, 12 insertions, 14 deletions
diff --git a/tests/Tests/Helpers.hs b/tests/Tests/Helpers.hs index b48c8af3a..69f40fe48 100644 --- a/tests/Tests/Helpers.hs +++ b/tests/Tests/Helpers.hs @@ -57,11 +57,11 @@ class ToString a where toString :: a -> String instance ToString Pandoc where - toString d = writeNative def{ writerStandalone = s } $ toPandoc d + toString d = writeNative def{ writerTemplate = s } $ toPandoc d where s = case d of (Pandoc (Meta m) _) - | M.null m -> False - | otherwise -> True + | M.null m -> Nothing + | otherwise -> Just "" -- need this to get meta output instance ToString Blocks where toString = writeNative def . toPandoc diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs index 8ae0532e4..2fe98b8ac 100644 --- a/tests/Tests/Readers/Docx.hs +++ b/tests/Tests/Readers/Docx.hs @@ -26,11 +26,11 @@ noNorm :: Pandoc -> NoNormPandoc noNorm = NoNormPandoc instance ToString NoNormPandoc where - toString d = writeNative def{ writerStandalone = s } $ toPandoc d + toString d = writeNative def{ writerTemplate = s } $ toPandoc d where s = case d of NoNormPandoc (Pandoc (Meta m) _) - | M.null m -> False - | otherwise -> True + | M.null m -> Nothing + | otherwise -> Just "" -- need this to get meta output instance ToPandoc NoNormPandoc where toPandoc = unNoNorm diff --git a/tests/Tests/Readers/Odt.hs b/tests/Tests/Readers/Odt.hs index cd764dd62..c4fc6fcc1 100644 --- a/tests/Tests/Readers/Odt.hs +++ b/tests/Tests/Readers/Odt.hs @@ -41,11 +41,11 @@ newtype NoNormPandoc = NoNormPandoc {unNoNorm :: Pandoc} deriving ( Show ) instance ToString NoNormPandoc where - toString d = writeNative def{ writerStandalone = s } $ toPandoc d + toString d = writeNative def{ writerTemplate = s } $ toPandoc d where s = case d of NoNormPandoc (Pandoc (Meta m) _) - | M.null m -> False - | otherwise -> True + | M.null m -> Nothing + | otherwise -> Just "" -- need this for Meta output instance ToPandoc NoNormPandoc where toPandoc = unNoNorm diff --git a/tests/Tests/Writers/Native.hs b/tests/Tests/Writers/Native.hs index a8659587f..7ec43b339 100644 --- a/tests/Tests/Writers/Native.hs +++ b/tests/Tests/Writers/Native.hs @@ -8,7 +8,7 @@ import Text.Pandoc.Arbitrary() p_write_rt :: Pandoc -> Bool p_write_rt d = - read (writeNative def{ writerStandalone = True } d) == d + read (writeNative def{ writerTemplate = Just "" } d) == d p_write_blocks_rt :: [Block] -> Bool p_write_blocks_rt bs = length bs > 20 || diff --git a/tests/Tests/Writers/RST.hs b/tests/Tests/Writers/RST.hs index e07d3ffee..77dafeb4c 100644 --- a/tests/Tests/Writers/RST.hs +++ b/tests/Tests/Writers/RST.hs @@ -47,8 +47,7 @@ tests = [ testGroup "rubrics" [ "foo" , "==="] -- note: heading normalization is only done in standalone mode - , test (writeRST def{ writerStandalone = True, - writerTemplate = "$body$\n" } . toPandoc) + , test (writeRST def{ writerTemplate = Just "$body$\n" } . toPandoc) "heading levels" $ header 1 (text "Header 1") <> header 3 (text "Header 2") <> @@ -78,8 +77,7 @@ tests = [ testGroup "rubrics" , "" , "Header 2" , "--------"] - , test (writeRST def{ writerStandalone = True, - writerTemplate = "$body$\n" } . toPandoc) + , test (writeRST def{ writerTemplate = Just "$body$\n" } . toPandoc) "minimal heading levels" $ header 2 (text "Header 1") <> header 3 (text "Header 2") <> |