diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-11-05 07:27:55 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-11-05 08:42:52 +0300 |
commit | 0c84630549c4b452d2eb5a3d82df5fc62ca593e6 (patch) | |
tree | de2129cddf56764931c1d5cdd07fdfa1c2fe0e54 /test | |
parent | a4968d775d00837ce5192fc641a1e7c80c483e68 (diff) | |
download | pandoc-0c84630549c4b452d2eb5a3d82df5fc62ca593e6.tar.gz |
Muse writer: add support for --reference-location=
Address #107
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Writers/Muse.hs | 88 |
1 files changed, 85 insertions, 3 deletions
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 57fbb3e57..ad4f421a3 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -9,10 +9,13 @@ import Text.Pandoc import Text.Pandoc.Arbitrary () import Text.Pandoc.Builder +defopts :: WriterOptions +defopts = def{ writerWrapText = WrapPreserve, + writerExtensions = extensionsFromList [Ext_amuse, + Ext_auto_identifiers] } + muse :: (ToPandoc a) => a -> String -muse = museWithOpts def{ writerWrapText = WrapPreserve, - writerExtensions = extensionsFromList [Ext_amuse, - Ext_auto_identifiers] } +muse = museWithOpts defopts museWithOpts :: (ToPandoc a) => WriterOptions -> a -> String museWithOpts opts = unpack . purely (writeMuse opts) . toPandoc @@ -22,6 +25,84 @@ infix 4 =: => String -> (a, String) -> TestTree (=:) = test muse +noteLocationTestDoc :: Blocks +noteLocationTestDoc = + header 1 (text "First Header") <> + para (text "This is a footnote." <> + note (para (text "First note."))) <> + blockQuote (para (text "A note inside a block quote." <> + note (para (text "The second note."))) <> + para (text "A second paragraph.")) <> + header 1 (text "Second Header") <> + para (text "Some more text.") + +noteLocationTests :: TestTree +noteLocationTests = testGroup "note location" + [ test (museWithOpts defopts {writerReferenceLocation=EndOfDocument}) + "footnotes at the end of document" $ + noteLocationTestDoc =?> + (unlines [ "* First Header" + , "" + , "This is a footnote.[1]" + , "" + , "<quote>" + , "A note inside a block quote.[2]" + , "" + , "A second paragraph." + , "</quote>" + , "" + , "* Second Header" + , "" + , "Some more text." + , "" + , "[1] First note." + , "" + , "[2] The second note." + ]) + , test (museWithOpts defopts {writerReferenceLocation=EndOfBlock}) + "footnotes at the end of block" $ + noteLocationTestDoc =?> + (unlines [ "* First Header" + , "" + , "This is a footnote.[1]" + , "" + , "[1] First note." + , "" + , "<quote>" + , "A note inside a block quote.[2]" + , "" + , "[2] The second note." + , "" + , "A second paragraph." + , "</quote>" + , "" + , "* Second Header" + , "" + , "Some more text." + ]) + , test (museWithOpts defopts {writerReferenceLocation=EndOfSection}) + "footnotes at the end of section" $ + noteLocationTestDoc =?> + (unlines [ "* First Header" + , "" + , "This is a footnote.[1]" + , "" + , "<quote>" + , "A note inside a block quote.[2]" + , "" + , "A second paragraph." + , "</quote>" + , "" + , "[1] First note." + , "" + , "[2] The second note." + , "" + , "* Second Header" + , "" + , "Some more text." + ]) + ] + tests :: [TestTree] tests = [ testGroup "block elements" [ "plain" =: plain (text "Foo bar.") =?> "Foo bar." @@ -501,6 +582,7 @@ tests = [ testGroup "block elements" , "" , "[1] Foo" ] + , noteLocationTests , "span with class" =: spanWith ("",["foobar"],[]) (text "Some text") =?> "<class name=\"foobar\">Some text</class>" , "span without class" =: spanWith ("",[],[]) (text "Some text") |