Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2014-05-03 22:33:36 -07:00
|
|
|
module Tests.Writers.AsciiDoc (tests) where
|
|
|
|
|
2017-06-10 23:39:49 +02:00
|
|
|
import Data.Text (unpack)
|
2017-03-14 17:05:36 +01:00
|
|
|
import Test.Tasty
|
2014-05-03 22:33:36 -07:00
|
|
|
import Tests.Helpers
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc
|
|
|
|
import Text.Pandoc.Arbitrary ()
|
|
|
|
import Text.Pandoc.Builder
|
2014-05-03 22:33:36 -07:00
|
|
|
|
2016-07-14 08:54:06 -07:00
|
|
|
asciidoc :: (ToPandoc a) => a -> String
|
2017-06-10 23:39:49 +02:00
|
|
|
asciidoc = unpack . purely (writeAsciiDoc def{ writerWrapText = WrapNone }) . toPandoc
|
2014-05-03 22:33:36 -07:00
|
|
|
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
testAsciidoc :: (ToString a, ToPandoc a)
|
|
|
|
=> String
|
|
|
|
-> (a, String)
|
|
|
|
-> TestTree
|
|
|
|
testAsciidoc = test asciidoc
|
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
tests :: [TestTree]
|
2014-07-20 12:24:53 -07:00
|
|
|
tests = [ testGroup "emphasis"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
[ testAsciidoc "emph word before" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (text "foo" <> emph (text "bar")) =?>
|
|
|
|
"foo__bar__"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
, testAsciidoc "emph word after" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (emph (text "foo") <> text "bar") =?>
|
|
|
|
"__foo__bar"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
, testAsciidoc "emph quoted" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (doubleQuoted (emph (text "foo"))) =?>
|
|
|
|
"``__foo__''"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
, testAsciidoc "strong word before" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (text "foo" <> strong (text "bar")) =?>
|
|
|
|
"foo**bar**"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
, testAsciidoc "strong word after" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (strong (text "foo") <> text "bar") =?>
|
|
|
|
"**foo**bar"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
, testAsciidoc "strong quoted" $
|
2014-07-20 12:24:53 -07:00
|
|
|
para (singleQuoted (strong (text "foo"))) =?>
|
|
|
|
"`**foo**'"
|
|
|
|
]
|
2021-10-14 16:16:25 +02:00
|
|
|
, testGroup "blocks"
|
|
|
|
[ testAsciidoc "code block without line numbers" $
|
|
|
|
codeBlockWith ("", [ "haskell" ], []) "foo" =?> unlines
|
|
|
|
[ "[source,haskell]"
|
|
|
|
, "----"
|
|
|
|
, "foo"
|
|
|
|
, "----"
|
|
|
|
]
|
|
|
|
, testAsciidoc "code block with line numbers" $
|
|
|
|
codeBlockWith ("", [ "haskell", "numberLines" ], []) "foo" =?> unlines
|
|
|
|
[ "[source%linesnum,haskell]"
|
|
|
|
, "----"
|
|
|
|
, "foo"
|
|
|
|
, "----"
|
|
|
|
]
|
|
|
|
]
|
2014-07-20 12:24:53 -07:00
|
|
|
, testGroup "tables"
|
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884.
+ Use pandoc-types 1.20 and texmath 0.12.
+ Text is now used instead of String, with a few exceptions.
+ In the MediaBag module, some of the types using Strings
were switched to use FilePath instead (not Text).
+ In the Parsing module, new parsers `manyChar`, `many1Char`,
`manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`,
`mantyUntilChar` have been added: these are like their
unsuffixed counterparts but pack some or all of their output.
+ `glob` in Text.Pandoc.Class still takes String since it seems
to be intended as an interface to Glob, which uses strings.
It seems to be used only once in the package, in the EPUB writer,
so that is not hard to change.
2019-11-04 16:12:37 -05:00
|
|
|
[ testAsciidoc "empty cells" $
|
2014-05-03 22:33:36 -07:00
|
|
|
simpleTable [] [[mempty],[mempty]] =?> unlines
|
|
|
|
[ "[cols=\"\",]"
|
2019-01-07 22:10:34 -08:00
|
|
|
, "|==="
|
2014-05-03 22:33:36 -07:00
|
|
|
, "|"
|
|
|
|
, "|"
|
2019-01-07 22:10:34 -08:00
|
|
|
, "|==="
|
2014-05-03 22:33:36 -07:00
|
|
|
]
|
|
|
|
, test asciidoc "multiblock cells" $
|
2014-07-20 12:24:53 -07:00
|
|
|
simpleTable [] [[para (text "Para 1") <> para (text "Para 2")]]
|
2014-05-03 22:33:36 -07:00
|
|
|
=?> unlines
|
|
|
|
[ "[cols=\"\",]"
|
2019-01-07 22:10:34 -08:00
|
|
|
, "|==="
|
2014-05-03 22:33:36 -07:00
|
|
|
, "a|"
|
|
|
|
, "Para 1"
|
|
|
|
, ""
|
|
|
|
, "Para 2"
|
|
|
|
, ""
|
2019-01-07 22:10:34 -08:00
|
|
|
, "|==="
|
2014-05-03 22:33:36 -07:00
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|