aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/RunTests.hs21
-rw-r--r--tests/biblatex-citations.latex70
-rw-r--r--tests/markdown-citations.chicago-author-date.txt15
-rw-r--r--tests/markdown-citations.ieee.txt15
-rw-r--r--tests/markdown-citations.mhra.txt18
-rw-r--r--tests/markdown-citations.txt56
-rw-r--r--tests/natbib-citations.latex72
7 files changed, 245 insertions, 22 deletions
diff --git a/tests/RunTests.hs b/tests/RunTests.hs
index 0d8a1a6a1..0dc11ef0c 100644
--- a/tests/RunTests.hs
+++ b/tests/RunTests.hs
@@ -111,6 +111,11 @@ main = do
r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]
"testsuite.native" "testsuite.native"
r14s <- mapM (\style -> runTest ("markdown reader (citations) (" ++ style ++ ")") ["-r", "markdown", "-w", "markdown", "--bibliography", "biblio.bib", "--csl", style ++ ".csl", "--no-wrap"] "markdown-citations.txt" ("markdown-citations." ++ style ++ ".txt")) ["chicago-author-date","ieee","mhra"]
+ let citopts = ["--bibliography", "biblio.bib", "--csl", "chicago-author-date.csl", "--no-citeproc"]
+ r15 <- runTest "markdown writer (citations)" (["-r", "markdown", "-w", "markdown"] ++ citopts)
+ "markdown-citations.txt" "markdown-citations.txt"
+ r16s <- runLatexCitationTests citopts "biblatex"
+ r17s <- runLatexCitationTests citopts "natbib"
r12s <- if runLhsTests
then mapM runLhsWriterTest lhsWriterFormats
else putStrLn "Skipping lhs writer tests because they presuppose highlighting support" >> return []
@@ -126,7 +131,8 @@ main = do
, r10 -- latex
, rTextile1 -- textile
, r11 -- native
- ] ++ r12s ++ r13s ++ r14s
+ , r15 -- markdown citations
+ ] ++ r12s ++ r13s ++ r14s ++ r16s ++ r17s
if all id results
then do
putStrLn "\nAll tests passed."
@@ -149,6 +155,19 @@ runLhsReaderTest :: String -> IO Bool
runLhsReaderTest format =
runTest ("(lhs) " ++ format ++ " reader") ["-r", format, "-w", "html+lhs"] ("lhs-test" <.> format) "lhs-test.fragment.html+lhs"
+
+runLatexCitationTests :: [String] -> String -> IO [Bool]
+runLatexCitationTests o n
+ = sequence [ rt ("latex reader (" ++ n ++ " citations)") (["-r", "latex", "-w", "markdown", "-s"] ++ o')
+ f "markdown-citations.txt"
+ , rt ("latex writer (" ++ n ++ " citations)") (["-r", "markdown", "-w", "latex", "-s"] ++ o')
+ "markdown-citations.txt" f
+ ]
+ where
+ o' = o ++ ["--" ++ n]
+ f = n ++ "-citations.latex"
+ rt = runTest
+
runWriterTest :: String -> IO Bool
runWriterTest format = do
r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)
diff --git a/tests/biblatex-citations.latex b/tests/biblatex-citations.latex
new file mode 100644
index 000000000..88c441234
--- /dev/null
+++ b/tests/biblatex-citations.latex
@@ -0,0 +1,70 @@
+\documentclass{article}
+\usepackage{amssymb,amsmath}
+\usepackage[mathletters]{ucs}
+\usepackage[utf8x]{inputenc}
+\usepackage{biblatex}
+\bibliography{biblio}
+\usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{6pt plus 2pt minus 1pt}
+\setcounter{secnumdepth}{0}
+
+
+\begin{document}
+
+\section{Pandoc with citeproc-hs}
+
+\begin{itemize}
+\item
+ {[}@nonexistent{]}
+
+\item
+ @nonexistent
+
+\item
+ \textcite{item1} says blah.
+
+\item
+ \textcite[p.~30]{item1} says blah.
+
+\item
+ \textcite[p.~30, with suffix]{item1} says blah.
+
+\item
+ \textcites{item1}[p.~30]{item2}[see also][]{item3} says blah.
+
+\item
+ In a note.%
+ \footnote{A citation without locators \autocite{item3}.}
+
+\item
+ A citation group
+ \autocites[see][, p.~34--35]{item1}[also][chap. 3]{item3}.
+
+\item
+ Another one \autocite[see][p.~34--35]{item1}.
+
+\item
+ And another one in a note.%
+ \footnote{Some citations \autocites[see][chap. 3]{item2}{item3}{item1}.}
+
+\item
+ Citation with a suffix and locator
+ \autocite[, pp.~33, 35--37, and nowhere else]{item1}.
+
+\item
+ Citation with suffix only \autocite[, and nowhere else]{item1}.
+
+\item
+ Now some modifiers.%
+ \footnote{Like a citation without author: \autocite*{item1}, and now Doe with
+a locator \autocite*[p.~44]{item2}.}
+
+\item
+ With some markup \autocite[\emph{see}][p. \textbf{32}]{item1}.
+
+\end{itemize}
+\section{References}
+\printbibliography
+
+\end{document}
diff --git a/tests/markdown-citations.chicago-author-date.txt b/tests/markdown-citations.chicago-author-date.txt
index 42a28c5d2..dd89b786f 100644
--- a/tests/markdown-citations.chicago-author-date.txt
+++ b/tests/markdown-citations.chicago-author-date.txt
@@ -1,19 +1,34 @@
# Pandoc with citeproc-hs
- [@nonexistent]
+
- @nonexistent
+
- Doe (2005) says blah.
+
- Doe (2005, 30) says blah.
+
- Doe (2005, 30, with suffix) says blah.
+
- Doe (2005; 2006, 30; see also Doe and Roe 2007) says blah.
+
- In a note.[^1]
+
- A citation group (see Doe 2005, 34–35; also Doe and Roe 2007, chap. 3).
+
- Another one (see Doe 2005, 34–35).
+
- And another one in a note.[^2]
+
- Citation with a suffix and locator (Doe 2005, 33, 35–37, and nowhere else).
+
- Citation with suffix only (Doe 2005, and nowhere else).
+
- Now some modifiers.[^3]
+- With some markup (*see* Doe 2005, 32).
+
+
# References
Doe, John. 2005. *First Book*. Cambridge: Cambridge University Press.
diff --git a/tests/markdown-citations.ieee.txt b/tests/markdown-citations.ieee.txt
index 6020d51b7..53f0995a4 100644
--- a/tests/markdown-citations.ieee.txt
+++ b/tests/markdown-citations.ieee.txt
@@ -1,19 +1,34 @@
# Pandoc with citeproc-hs
- [@nonexistent]
+
- @nonexistent
+
- Reference [1] says blah.
+
- Reference [1] says blah.
+
- Reference [1] says blah.
+
- Reference [1] says blah.
+
- In a note.[^1]
+
- A citation group [1],[3].
+
- Another one [1].
+
- And another one in a note.[^2]
+
- Citation with a suffix and locator [1].
+
- Citation with suffix only [1].
+
- Now some modifiers.[^3]
+- With some markup [1].
+
+
# References
[1] J. Doe, *First Book*, Cambridge: Cambridge University Press, 2005.
diff --git a/tests/markdown-citations.mhra.txt b/tests/markdown-citations.mhra.txt
index acd700f0d..a05db2a54 100644
--- a/tests/markdown-citations.mhra.txt
+++ b/tests/markdown-citations.mhra.txt
@@ -1,19 +1,34 @@
# Pandoc with citeproc-hs
- [@nonexistent]
+
- @nonexistent
+
- John Doe[^1] says blah.
+
- Doe[^2] says blah.
+
- Doe[^3] says blah.
+
- Doe[^4] says blah.
+
- In a note.[^5]
+
- A citation group.[^6]
+
- Another one.[^7]
+
- And another one in a note.[^8]
+
- Citation with a suffix and locator.[^9]
+
- Citation with suffix only.[^10]
+
- Now some modifiers.[^11]
+- With some markup.[^12]
+
+
# References
Doe, John, ‘Article’, *Journal of Generic Studies*, 6 (2006), 33-34.
@@ -54,3 +69,6 @@ Doe, John, and Jenny Roe, ‘Why Water Is Wet’, in *Third Book*, ed by Sam Smi
[^11]:
Like a citation without author: First Book, and now Doe with a locator Article, 33-34 (p. 44).
+
+[^12]:
+ *See* Doe, First Book, p. 32.
diff --git a/tests/markdown-citations.txt b/tests/markdown-citations.txt
index 9b6992f90..43154d2d4 100644
--- a/tests/markdown-citations.txt
+++ b/tests/markdown-citations.txt
@@ -1,29 +1,43 @@
# Pandoc with citeproc-hs
-- [@nonexistent]
-- @nonexistent
-- @item1 says blah.
-- @item1 [p. 30] says blah.
-- @item1 [p. 30, with suffix] says blah.
-- @item1 [-@item2 p. 30; see also @item3] says blah.
-- In a note.[^1]
-- A citation group [see @item1, p. 34-35; also @item3 chap. 3].
-- Another one [see
- @item1 p. 34-35].
-- And another one in a note.[^2]
-- Citation with a suffix and locator [@item1, pp. 33, 35-37, and nowhere else].
-- Citation with suffix only [@item1, and nowhere else].
-- Now some modifiers.[^3]
+- [@nonexistent]
-[^1]:
- A citation without locators [@item3].
+- @nonexistent
-[^2]:
- Some citations [see @item2 chap. 3; @item3; @item1].
+- @item1 says blah.
+
+- @item1 [p. 30] says blah.
+
+- @item1 [p. 30, with suffix] says blah.
+
+- @item1 [-@item2 p. 30; see also @item3] says blah.
+
+- In a note.[^1]
+
+- A citation group [see @item1, p. 34-35; also @item3 chap. 3].
+
+- Another one [see @item1 p. 34-35].
+
+- And another one in a note.[^2]
+
+- Citation with a suffix and locator
+ [@item1, pp. 33, 35-37, and nowhere else].
+
+- Citation with suffix only [@item1, and nowhere else].
+
+- Now some modifiers.[^3]
+
+- With some markup [*see* @item1 p. **32**].
-[^3]:
- Like a citation without author: [-@item1], and now Doe with a
- locator [-@item2, p. 44].
# References
+[^1]:
+ A citation without locators [@item3].
+
+[^2]:
+ Some citations [see @item2 chap. 3; @item3; @item1].
+
+[^3]:
+ Like a citation without author: [-@item1], and now Doe with a
+ locator [-@item2 p. 44].
diff --git a/tests/natbib-citations.latex b/tests/natbib-citations.latex
new file mode 100644
index 000000000..503d9cd9b
--- /dev/null
+++ b/tests/natbib-citations.latex
@@ -0,0 +1,72 @@
+\documentclass{article}
+\usepackage{amssymb,amsmath}
+\usepackage[mathletters]{ucs}
+\usepackage[utf8x]{inputenc}
+\usepackage{natbib}
+\bibliographystyle{plainnat}
+\usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{6pt plus 2pt minus 1pt}
+\setcounter{secnumdepth}{0}
+
+
+\begin{document}
+
+\section{Pandoc with citeproc-hs}
+
+\begin{itemize}
+\item
+ {[}@nonexistent{]}
+
+\item
+ @nonexistent
+
+\item
+ \citet{item1} says blah.
+
+\item
+ \citet[p.~30]{item1} says blah.
+
+\item
+ \citet[p.~30, with suffix]{item1} says blah.
+
+\item
+ \citeauthor{item1} \citetext{\citeyear{item1}; \citeyear[p.~30]{item2}; \citealp[see also][]{item3}}
+ says blah.
+
+\item
+ In a note.%
+ \footnote{A citation without locators \citep{item3}.}
+
+\item
+ A citation group
+ \citetext{\citealp[see][, p.~34--35]{item1}; \citealp[also][chap. 3]{item3}}.
+
+\item
+ Another one \citep[see][p.~34--35]{item1}.
+
+\item
+ And another one in a note.%
+ \footnote{Some citations
+\citetext{\citealp[see][chap. 3]{item2}; \citealp{item3}; \citealp{item1}}.}
+
+\item
+ Citation with a suffix and locator
+ \citep[, pp.~33, 35--37, and nowhere else]{item1}.
+
+\item
+ Citation with suffix only \citep[, and nowhere else]{item1}.
+
+\item
+ Now some modifiers.%
+ \footnote{Like a citation without author: \citeyearpar{item1}, and now Doe
+with a locator \citeyearpar[p.~44]{item2}.}
+
+\item
+ With some markup \citep[\emph{see}][p. \textbf{32}]{item1}.
+
+\end{itemize}
+\section{References}
+\bibliography{biblio}
+
+\end{document}