diff options
-rw-r--r-- | pandoc.cabal | 1 | ||||
-rw-r--r-- | tests/Tests/Old.hs | 20 | ||||
-rw-r--r-- | tests/Tests/Readers/LaTeX.hs | 47 | ||||
-rw-r--r-- | tests/biblatex-citations.latex | 49 |
4 files changed, 46 insertions, 71 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index 79017e9d4..e9c2a3b9d 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -94,7 +94,6 @@ Extra-Source-Files: tests/mhra.csl, tests/latex-reader.latex, tests/latex-reader.native, - tests/biblatex-citations.latex, tests/textile-reader.textile, tests/textile-reader.native, tests/markdown-reader-more.txt, diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs index 7321308de..cb1417ffa 100644 --- a/tests/Tests/Old.hs +++ b/tests/Tests/Old.hs @@ -10,7 +10,7 @@ import System.FilePath ( (</>), (<.>) ) import System.Directory import System.Exit import Data.Algorithm.Diff -import Text.Pandoc.Shared ( substitute, normalize, defaultWriterOptions ) +import Text.Pandoc.Shared ( normalize, defaultWriterOptions ) import Text.Pandoc.Writers.Native ( writeNative ) import Text.Pandoc.Readers.Native ( readNative ) import Text.Pandoc.Highlighting ( languages ) @@ -80,7 +80,6 @@ tests = [ testGroup "markdown" "latex-reader.latex" "latex-reader.native" , lhsReaderTest "latex+lhs" ] - , latexCitationTests "biblatex" ] , testGroup "html" [ testGroup "writer" (writerTests "html" ++ lhsWriterTests "html") @@ -133,23 +132,6 @@ lhsReaderTest format = ("lhs-test" <.> format) "lhs-test.native" where normalizer = writeNative defaultWriterOptions . normalize . readNative -latexCitationTests :: String -> Test -latexCitationTests n - = testGroup (n ++ " citations") - [ t ("latex reader (" ++ n ++ " citations)") - (["-r", "latex", "-w", "markdown", "-s", "--no-wrap"] ++ o) - f "markdown-citations.txt" - , t ("latex writer (" ++ n ++ " citations)") - (["-r", "markdown", "-w", "latex", "-s", "--no-wrap"] ++ o) - "markdown-citations.txt" f - ] - where - o = ["--bibliography", "biblio.bib", "--csl", "chicago-author-date.csl", - "--natbib", "--" ++ n] - f = n ++ "-citations.latex" - normalizer = substitute "\160" " " . substitute "\8211" "-" - t = testWithNormalize normalizer - writerTests :: String -> [Test] writerTests format = [ test "basic" (opts ++ ["-s"]) "testsuite.native" ("writer" <.> format) diff --git a/tests/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs index f230ef5bf..7ea4c73ee 100644 --- a/tests/Tests/Readers/LaTeX.hs +++ b/tests/Tests/Readers/LaTeX.hs @@ -104,6 +104,49 @@ natbibCitations = testGroup "natbib" biblatexCitations :: Test biblatexCitations = testGroup "biblatex" - [ + [ "textcite" =: "\\textcite{item1}" + =?> para (cite [baseCitation] empty) + , "suffix" =: "\\textcite[p.~30]{item1}" + =?> para + (cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] empty) + , "suffix long" =: "\\textcite[p.~30, with suffix]{item1}" + =?> para (cite [baseCitation{ citationSuffix = + toList $ text "p.\160\&30, with suffix" }] empty) + , "multiple" =: "\\textcites{item1}[p.~30]{item2}[see also][]{item3}" + =?> para (cite [baseCitation{ citationMode = AuthorInText } + ,baseCitation{ citationMode = NormalCitation + , citationSuffix = [Str "p.\160\&30"] + , citationId = "item2" } + ,baseCitation{ citationId = "item3" + , citationPrefix = [Str "see",Space,Str "also"] + , citationMode = NormalCitation } + ] empty) + , "group" =: "\\autocites[see][p.~34--35]{item1}[also][chap. 3]{item3}" + =?> para (cite [baseCitation{ citationMode = NormalCitation + , citationPrefix = [Str "see"] + , citationSuffix = [Str "p.\160\&34",EnDash,Str "35"] } + ,baseCitation{ citationMode = NormalCitation + , citationId = "item3" + , citationPrefix = [Str "also"] + , citationSuffix = [Str "chap.",Space,Str "3"] } + ] empty) + , "suffix and locator" =: "\\autocite[pp.~33, 35--37, and nowhere else]{item1}" + =?> para (cite [baseCitation{ citationMode = NormalCitation + , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] empty) + , "suffix only" =: "\\autocite[and nowhere else]{item1}" + =?> para (cite [baseCitation{ citationMode = NormalCitation + , citationSuffix = toList $ text "and nowhere else" }] empty) + , "no author" =: "\\autocite*{item1}, and now Doe with a locator \\autocite*[p.~44]{item2}" + =?> para (cite [baseCitation{ citationMode = SuppressAuthor }] empty +++ + text ", and now Doe with a locator " +++ + cite [baseCitation{ citationMode = SuppressAuthor + , citationSuffix = [Str "p.\160\&44"] + , citationId = "item2" }] empty) + , "markup" =: "\\autocite[\\emph{see}][p. \\textbf{32}]{item1}" + =?> para (cite [baseCitation{ citationMode = NormalCitation + , citationPrefix = [Emph [Str "see"]] + , citationSuffix = [Str "p.",Space, + Strong [Str "32"]] }] empty) + , "parencite" =: "\\parencite{item1}" + =?> para (cite [baseCitation{ citationMode = NormalCitation }] empty) ] - diff --git a/tests/biblatex-citations.latex b/tests/biblatex-citations.latex deleted file mode 100644 index 97647cd41..000000000 --- a/tests/biblatex-citations.latex +++ /dev/null @@ -1,49 +0,0 @@ -\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} -\printbibliography[title=References] - -\end{document} |