aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Creole.hs15
-rw-r--r--test/Tests/Writers/FB2.hs34
-rw-r--r--test/command/3596.md6
-rw-r--r--test/command/4012.md8
-rw-r--r--test/command/4016.md47
-rw-r--r--test/command/4019.md8
-rw-r--r--test/command/latex-command-comment.md7
-rw-r--r--test/test-pandoc.hs2
-rw-r--r--test/writer.fb290
-rw-r--r--test/writer.jats12
10 files changed, 180 insertions, 49 deletions
diff --git a/test/Tests/Readers/Creole.hs b/test/Tests/Readers/Creole.hs
index 96517c25c..3a21df738 100644
--- a/test/Tests/Readers/Creole.hs
+++ b/test/Tests/Readers/Creole.hs
@@ -127,6 +127,11 @@ tests = [
=?> bulletList [ plain "foo"
<> bulletList [ plain "bar", plain "baz" ]
, plain "blubb" ]
+ , "nested unordered list, one separating space, trailing space" =:
+ "* foo \n** bar \n** baz \n* blubb "
+ =?> bulletList [ plain "foo"
+ <> bulletList [ plain "bar", plain "baz" ]
+ , plain "blubb" ]
, "ordered list, two entries, one separating space" =:
"# foo\n# bar"
=?> orderedList [ plain "foo", plain "bar" ]
@@ -141,6 +146,11 @@ tests = [
=?> orderedList [ plain "foo"
<> orderedList [ plain "bar", plain "baz" ]
, plain "blubb" ]
+ , "nested ordered list, one separating space, trailing space" =:
+ "# foo \n## bar \n## baz \n# blubb "
+ =?> orderedList [ plain "foo"
+ <> orderedList [ plain "bar", plain "baz" ]
+ , plain "blubb" ]
, "nested many ordered lists, one separating space" =:
("# foo\n## bar\n### third\n### third two\n## baz\n### third again\n"
<> "#### fourth\n##### fith\n# blubb")
@@ -193,7 +203,10 @@ tests = [
, "forced line breaks" =:
"{{{no break!\\\\here}}} but a break\\\\here!"
=?> para (code "no break!\\\\here" <> " but a break"
- <> linebreak <> "here!")
+ <> linebreak <> "here!"),
+ "quoted block, after trailing white space" =:
+ "this is a paragraph \n{{{\nfoo bar\n //baz//\n}}}"
+ =?> para "this is a paragraph" <> codeBlock "foo bar\n //baz//"
]
, testGroup "Images and Links" [
"image simple" =:
diff --git a/test/Tests/Writers/FB2.hs b/test/Tests/Writers/FB2.hs
new file mode 100644
index 000000000..77ab4a82c
--- /dev/null
+++ b/test/Tests/Writers/FB2.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Tests.Writers.FB2 (tests) where
+
+import Test.Tasty
+import Tests.Helpers
+import Text.Pandoc
+import Text.Pandoc.Arbitrary ()
+import Text.Pandoc.Builder
+
+fb2 :: String -> String
+fb2 x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ++
+ "<FictionBook xmlns=\"http://www.gribuser.ru/xml/fictionbook/2.0\" xmlns:l=\"http://www.w3.org/1999/xlink\"><description><title-info /><document-info><program-used>pandoc</program-used></document-info></description><body><title><p /></title><annotation><p></p></annotation><section>" ++ x ++ "</section></body></FictionBook>"
+
+infix 4 =:
+(=:) :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> TestTree
+(=:) = test (purely (writeFB2 def) . toPandoc)
+
+tests :: [TestTree]
+tests = [ testGroup "block elements"
+ ["para" =: para "Lorem ipsum cetera."
+ =?> fb2 "<p>Lorem ipsum cetera.</p>"
+ ]
+ , testGroup "inlines"
+ [
+ "Emphasis" =: emph ("emphasized")
+ =?> fb2 "<emphasis>emphasized</emphasis>"
+ ]
+ , "bullet list" =: bulletList [ plain $ text "first"
+ , plain $ text "second"
+ , plain $ text "third"
+ ]
+ =?> fb2 "<p>\x2022 first</p><p>\x2022 second</p><p>\x2022 third</p>"
+ ]
diff --git a/test/command/3596.md b/test/command/3596.md
index a064ca632..01a871e1b 100644
--- a/test/command/3596.md
+++ b/test/command/3596.md
@@ -50,11 +50,9 @@
^D
- foo
-- <div id="id">
-
+- ::: {#id}
bar
-
- </div>
+ :::
- baz
diff --git a/test/command/4012.md b/test/command/4012.md
new file mode 100644
index 000000000..579ee2459
--- /dev/null
+++ b/test/command/4012.md
@@ -0,0 +1,8 @@
+```
+pandoc -f markdown-implicit_figures
+![image]
+
+[image]: http://example.com/image.jpg {height=35mm}
+^D
+<p><img src="http://example.com/image.jpg" alt="image" style="height:35mm" /></p>
+```
diff --git a/test/command/4016.md b/test/command/4016.md
new file mode 100644
index 000000000..69ad1c911
--- /dev/null
+++ b/test/command/4016.md
@@ -0,0 +1,47 @@
+```
+pandoc -t beamer
+# Level 2 blocks
+
+<div class="columns">
+<div class="column" width="40%">
+## Block one
+- Item
+</div>
+<div class="column" width="60%">
+## Block two
+- Item
+</div>
+</div>
+^D
+\begin{frame}{%
+\protect\hypertarget{level-2-blocks}{%
+Level 2 blocks}}
+
+\begin{columns}[T]
+\begin{column}{0.40\textwidth}
+\begin{block}{Block one}
+
+\begin{itemize}
+\tightlist
+\item
+ Item
+\end{itemize}
+
+\end{block}
+\end{column}
+
+\begin{column}{0.60\textwidth}
+\begin{block}{Block two}
+
+\begin{itemize}
+\tightlist
+\item
+ Item
+\end{itemize}
+
+\end{block}
+\end{column}
+\end{columns}
+
+\end{frame}
+```
diff --git a/test/command/4019.md b/test/command/4019.md
new file mode 100644
index 000000000..ab13f0233
--- /dev/null
+++ b/test/command/4019.md
@@ -0,0 +1,8 @@
+```
+pandoc --wrap=preserve
+This <!-- x > 0 --> works!
+This <!-- x > 0 --> fails?
+^D
+<p>This <!-- x > 0 --> works!
+This <!-- x > 0 --> fails?</p>
+```
diff --git a/test/command/latex-command-comment.md b/test/command/latex-command-comment.md
new file mode 100644
index 000000000..640277f15
--- /dev/null
+++ b/test/command/latex-command-comment.md
@@ -0,0 +1,7 @@
+```
+pandoc -f latex -t native
+\emph%
+{hi}
+^D
+[Para [Emph [Str "hi"]]]
+```
diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs
index 358354e42..e1ce1bc70 100644
--- a/test/test-pandoc.hs
+++ b/test/test-pandoc.hs
@@ -23,6 +23,7 @@ import qualified Tests.Writers.AsciiDoc
import qualified Tests.Writers.ConTeXt
import qualified Tests.Writers.Docbook
import qualified Tests.Writers.Docx
+import qualified Tests.Writers.FB2
import qualified Tests.Writers.HTML
import qualified Tests.Writers.LaTeX
import qualified Tests.Writers.Markdown
@@ -52,6 +53,7 @@ tests = testGroup "pandoc tests" [ Tests.Command.tests
, testGroup "RST" Tests.Writers.RST.tests
, testGroup "TEI" Tests.Writers.TEI.tests
, testGroup "Muse" Tests.Writers.Muse.tests
+ , testGroup "FB2" Tests.Writers.FB2.tests
]
, testGroup "Readers"
[ testGroup "LaTeX" Tests.Readers.LaTeX.tests
diff --git a/test/writer.fb2 b/test/writer.fb2
index 8a4986508..9b4645d50 100644
--- a/test/writer.fb2
+++ b/test/writer.fb2
@@ -261,23 +261,23 @@
<p>Nested</p>
</title>
<p>• Tab</p>
-<p>◦ Tab</p>
-<p>* Tab</p>
+<p>• • Tab</p>
+<p>• • • Tab</p>
<p>Here’s another:</p>
<p>1. First</p>
<p>2. Second:</p>
-<p>   • Fee</p>
-<p>   • Fie</p>
-<p>   • Foe</p>
+<p>2. • Fee</p>
+<p>2. • Fie</p>
+<p>2. • Foe</p>
<p>3. Third</p>
<p>Same thing but with paragraphs:</p>
<p>1. First</p>
<empty-line />
<p>2. Second:</p>
<empty-line />
-<p>   • Fee</p>
-<p>   • Fie</p>
-<p>   • Foe</p>
+<p>2. • Fee</p>
+<p>2. • Fie</p>
+<p>2. • Foe</p>
<p>3. Third</p>
<empty-line />
</section>
@@ -289,9 +289,9 @@
<empty-line />
<p>• this is a list item indented with spaces</p>
<empty-line />
-<p>◦ this is an example list item indented with tabs</p>
+<p>• • this is an example list item indented with tabs</p>
<empty-line />
-<p>◦ this is an example list item indented with spaces</p>
+<p>• • this is an example list item indented with spaces</p>
<empty-line />
</section>
<section>
@@ -332,64 +332,61 @@
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />
-</p>
+<p>    red fruit</p>
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />
-</p>
+<p>    orange fruit</p>
<p>
<strong>banana</strong>
</p>
-<p>    yellow fruit<empty-line />
-</p>
+<p>    yellow fruit</p>
<p>Tight using tabs:</p>
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />
-</p>
+<p>    red fruit</p>
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />
-</p>
+<p>    orange fruit</p>
<p>
<strong>banana</strong>
</p>
-<p>    yellow fruit<empty-line />
-</p>
+<p>    yellow fruit</p>
<p>Loose:</p>
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />
-</p>
+<p>    red fruit</p>
+<empty-line />
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />
-</p>
+<p>    orange fruit</p>
+<empty-line />
<p>
<strong>banana</strong>
</p>
-<p>    yellow fruit<empty-line />
-</p>
+<p>    yellow fruit</p>
+<empty-line />
<p>Multiple blocks with italics:</p>
<p>
<strong>
<emphasis>apple</emphasis>
</strong>
</p>
-<p>    red fruit<empty-line />    contains seeds, crisp, pleasant to taste<empty-line />
-</p>
+<p>    red fruit</p>
+<empty-line />
+<p>    contains seeds, crisp, pleasant to taste</p>
+<empty-line />
<p>
<strong>
<emphasis>orange</emphasis>
</strong>
</p>
-<p>    orange fruit<empty-line />
+<p>    orange fruit</p>
+<empty-line />
<empty-line />
<p>
<code>    { orange code block }</code>
@@ -398,42 +395,47 @@
<cite>
<p>    orange block quote</p>
</cite>
-</p>
<p>Multiple definitions, tight:</p>
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />    computer<empty-line />
-</p>
+<p>    red fruit</p>
+<p>    computer</p>
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />    bank<empty-line />
-</p>
+<p>    orange fruit</p>
+<p>    bank</p>
<p>Multiple definitions, loose:</p>
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />    computer<empty-line />
-</p>
+<p>    red fruit</p>
+<empty-line />
+<p>    computer</p>
+<empty-line />
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />    bank<empty-line />
-</p>
+<p>    orange fruit</p>
+<empty-line />
+<p>    bank</p>
+<empty-line />
<p>Blank line after term, indented marker, alternate markers:</p>
<p>
<strong>apple</strong>
</p>
-<p>    red fruit<empty-line />    computer<empty-line />
-</p>
+<p>    red fruit</p>
+<empty-line />
+<p>    computer</p>
+<empty-line />
<p>
<strong>orange</strong>
</p>
-<p>    orange fruit<empty-line />
+<p>    orange fruit</p>
+<empty-line />
<p>1. sublist</p>
<p>2. sublist</p>
-</p>
</section>
<section>
<title>
diff --git a/test/writer.jats b/test/writer.jats
index 6f808e109..0f52965bc 100644
--- a/test/writer.jats
+++ b/test/writer.jats
@@ -14,6 +14,18 @@
<title-group>
<article-title>Pandoc Test Suite</article-title>
</title-group>
+<contrib-group>
+<contrib contrib-type="author">
+<name>
+<string-name>John MacFarlane</string-name>
+</name>
+</contrib>
+<contrib contrib-type="author">
+<name>
+<string-name>Anonymous</string-name>
+</name>
+</contrib>
+</contrib-group>
<pub-date pub-type="epub">
<string-date>July 17, 2006</string-date>
</pub-date>