diff options
author | binaarinen <53334195+binaarinen@users.noreply.github.com> | 2021-12-19 21:10:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 12:10:41 -0800 |
commit | 0610f16f7f684b320325b6c0b501725138d10a52 (patch) | |
tree | a35f19aec4719a84d0b006bbfdc70b17c3c45970 /test/Tests | |
parent | f8f03c2ffca168d5c897febc2a631c2605973699 (diff) | |
download | pandoc-0610f16f7f684b320325b6c0b501725138d10a52.tar.gz |
Add a writer for Markua 0.10 (#7729)
Markua is a markdown variant used by Leanpub.
More information about Markua can be found at https://leanpub.com/markua/read.
Adds a new exported function `writeMarkua` from T.P.Writers.Markdown.
[API change]
Closes #1871.
Co-authored by Tim Wisotzki and Samuel Lemmenmeier.
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Old.hs | 1 | ||||
-rw-r--r-- | test/Tests/Writers/Markua.hs | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/test/Tests/Old.hs b/test/Tests/Old.hs index e03d94e85..450449946 100644 --- a/test/Tests/Old.hs +++ b/test/Tests/Old.hs @@ -228,6 +228,7 @@ tests pandocPath = , test' "reader" ["-f", "ipynb", "-t", "html"] "ipynb/rank.ipynb" "ipynb/rank.out.html" ] + , testGroup "markua" [ testGroup "writer" $ writerTests' "markua"] ] where test' = test pandocPath diff --git a/test/Tests/Writers/Markua.hs b/test/Tests/Writers/Markua.hs new file mode 100644 index 000000000..62239f3da --- /dev/null +++ b/test/Tests/Writers/Markua.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE OverloadedStrings #-} +module Tests.Writers.Markua (tests) where + +import Test.Tasty +import Tests.Helpers +import Text.Pandoc +import Text.Pandoc.Arbitrary () +import Text.Pandoc.Builder + +{- + "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) +-} + +infix 4 =: +(=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> TestTree +(=:) = test (purely (writeMarkua def) . toPandoc) + +tests :: [TestTree] +tests = [ testGroup "simple blurb/aside" + ["blurb" =: divWith ("",["blurb"],[]) (bulletList [para "blurb content"]) + =?> "B> * blurb content" + ,"aside" =: divWith ("",["aside"],[]) (bulletList [para "aside list"]) + =?> "A> * aside list" + ] + ,testGroup "multiclass blurb/aside" + ["blurb" =: divWith ("",["blurb", "otherclass"],[]) (bulletList [para "blurb content"]) + =?> "B> * blurb content" + ,"aside" =: divWith ("",["otherclass", "aside"],[]) (bulletList [para "aside list"]) + =?> "A> * aside list" + ] + ] |