aboutsummaryrefslogtreecommitdiff
path: root/tests/Tests/Writers
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Tests/Writers')
-rw-r--r--tests/Tests/Writers/AsciiDoc.hs1
-rw-r--r--tests/Tests/Writers/Docx.hs5
-rw-r--r--tests/Tests/Writers/LaTeX.hs2
-rw-r--r--tests/Tests/Writers/RST.hs32
4 files changed, 36 insertions, 4 deletions
diff --git a/tests/Tests/Writers/AsciiDoc.hs b/tests/Tests/Writers/AsciiDoc.hs
index f9e6bd154..56a62c6e4 100644
--- a/tests/Tests/Writers/AsciiDoc.hs
+++ b/tests/Tests/Writers/AsciiDoc.hs
@@ -5,7 +5,6 @@ import Text.Pandoc.Builder
import Text.Pandoc
import Tests.Helpers
import Tests.Arbitrary()
-import Data.Monoid
asciidoc :: (ToString a, ToPandoc a) => a -> String
asciidoc = writeAsciiDoc def{ writerWrapText = False } . toPandoc
diff --git a/tests/Tests/Writers/Docx.hs b/tests/Tests/Writers/Docx.hs
index 068c5a935..8dba0ea55 100644
--- a/tests/Tests/Writers/Docx.hs
+++ b/tests/Tests/Writers/Docx.hs
@@ -8,6 +8,7 @@ import Test.Framework
import Text.Pandoc.Readers.Docx
import Text.Pandoc.Writers.Docx
import Text.Pandoc.Error
+import System.FilePath ((</>))
type Options = (WriterOptions, ReaderOptions)
@@ -16,7 +17,9 @@ compareOutput :: Options
-> IO (Pandoc, Pandoc)
compareOutput opts nativeFile = do
nf <- Prelude.readFile nativeFile
- df <- writeDocx (fst opts) (handleError $ readNative nf)
+ let wopts = fst opts
+ df <- writeDocx wopts{writerUserDataDir = Just (".." </> "data")}
+ (handleError $ readNative nf)
let (p, _) = handleError $ readDocx (snd opts) df
return (p, handleError $ readNative nf)
diff --git a/tests/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs
index d1cfd3ddf..05dfcbd3d 100644
--- a/tests/Tests/Writers/LaTeX.hs
+++ b/tests/Tests/Writers/LaTeX.hs
@@ -42,7 +42,7 @@ tests = [ testGroup "code blocks"
, testGroup "definition lists"
[ "with internal link" =: definitionList [(link "#go" "" (str "testing"),
[plain (text "hi there")])] =?>
- "\\begin{description}\n\\tightlist\n\\item[{\\hyperref[go]{testing}}]\nhi there\n\\end{description}"
+ "\\begin{description}\n\\tightlist\n\\item[{\\protect\\hyperlink{go}{testing}}]\nhi there\n\\end{description}"
]
, testGroup "math"
[ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
diff --git a/tests/Tests/Writers/RST.hs b/tests/Tests/Writers/RST.hs
index 2a511782f..b9e359dae 100644
--- a/tests/Tests/Writers/RST.hs
+++ b/tests/Tests/Writers/RST.hs
@@ -46,7 +46,10 @@ tests = [ testGroup "rubrics"
unlines
[ "foo"
, "==="]
- , "heading levels" =:
+ -- note: heading normalization is only done in standalone mode
+ , test (writeRST def{ writerStandalone = True,
+ writerTemplate = "$body$\n" } . toPandoc)
+ "heading levels" $
header 1 (text "Header 1") <>
header 3 (text "Header 2") <>
header 2 (text "Header 2") <>
@@ -75,5 +78,32 @@ tests = [ testGroup "rubrics"
, ""
, "Header 2"
, "--------"]
+ , test (writeRST def{ writerStandalone = True,
+ writerTemplate = "$body$\n" } . toPandoc)
+ "minimal heading levels" $
+ header 2 (text "Header 1") <>
+ header 3 (text "Header 2") <>
+ header 2 (text "Header 1") <>
+ header 4 (text "Header 2") <>
+ header 5 (text "Header 3") <>
+ header 3 (text "Header 2") =?>
+ unlines
+ [ "Header 1"
+ , "========"
+ , ""
+ , "Header 2"
+ , "--------"
+ , ""
+ , "Header 1"
+ , "========"
+ , ""
+ , "Header 2"
+ , "--------"
+ , ""
+ , "Header 3"
+ , "~~~~~~~~"
+ , ""
+ , "Header 2"
+ , "--------"]
]
]