Added natbib citation tests to Tests.Readers.LaTeX.
Removed old tests/natbib-citations.latex.
This commit is contained in:
parent
3a3b484957
commit
7961208aaf
4 changed files with 65 additions and 52 deletions
|
@ -95,7 +95,6 @@ Extra-Source-Files:
|
|||
tests/latex-reader.latex,
|
||||
tests/latex-reader.native,
|
||||
tests/biblatex-citations.latex,
|
||||
tests/natbib-citations.latex,
|
||||
tests/textile-reader.textile,
|
||||
tests/textile-reader.native,
|
||||
tests/markdown-reader-more.txt,
|
||||
|
|
|
@ -81,7 +81,6 @@ tests = [ testGroup "markdown"
|
|||
, lhsReaderTest "latex+lhs"
|
||||
]
|
||||
, latexCitationTests "biblatex"
|
||||
, latexCitationTests "natbib"
|
||||
]
|
||||
, testGroup "html"
|
||||
[ testGroup "writer" (writerTests "html" ++ lhsWriterTests "html")
|
||||
|
|
|
@ -40,5 +40,70 @@ tests = [ testGroup "basic"
|
|||
"\\section{text \\href{/url}{link}}" =?>
|
||||
header 1 ("text" +++ space +++ link "/url" "" "link")
|
||||
]
|
||||
|
||||
, testGroup "citations"
|
||||
[ natbibCitations
|
||||
, biblatexCitations
|
||||
]
|
||||
]
|
||||
|
||||
baseCitation :: Citation
|
||||
baseCitation = Citation{ citationId = "item1"
|
||||
, citationPrefix = []
|
||||
, citationSuffix = []
|
||||
, citationMode = AuthorInText
|
||||
, citationNoteNum = 0
|
||||
, citationHash = 0 }
|
||||
|
||||
natbibCitations :: Test
|
||||
natbibCitations = testGroup "natbib"
|
||||
[ "citet" =: "\\citet{item1}"
|
||||
=?> para (cite [baseCitation] empty)
|
||||
, "suffix" =: "\\citet[p.~30]{item1}"
|
||||
=?> para
|
||||
(cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] empty)
|
||||
, "suffix long" =: "\\citet[p.~30, with suffix]{item1}"
|
||||
=?> para (cite [baseCitation{ citationSuffix =
|
||||
toList $ text "p.\160\&30, with suffix" }] empty)
|
||||
, "multiple" =: "\\citeauthor{item1} \\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"
|
||||
=?> para (cite [baseCitation{ citationMode = AuthorInText }
|
||||
,baseCitation{ citationMode = SuppressAuthor
|
||||
, citationSuffix = [Str "p.\160\&30"]
|
||||
, citationId = "item2" }
|
||||
,baseCitation{ citationId = "item3"
|
||||
, citationPrefix = [Str "see",Space,Str "also"]
|
||||
, citationMode = NormalCitation }
|
||||
] empty)
|
||||
, "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[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" =: "\\citep[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" =: "\\citep[and nowhere else]{item1}"
|
||||
=?> para (cite [baseCitation{ citationMode = NormalCitation
|
||||
, citationSuffix = toList $ text "and nowhere else" }] empty)
|
||||
, "no author" =: "\\citeyearpar{item1}, and now Doe with a locator \\citeyearpar[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" =: "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"
|
||||
=?> para (cite [baseCitation{ citationMode = NormalCitation
|
||||
, citationPrefix = [Emph [Str "see"]]
|
||||
, citationSuffix = [Str "p.",Space,
|
||||
Strong [Str "32"]] }] empty)
|
||||
]
|
||||
|
||||
biblatexCitations :: Test
|
||||
biblatexCitations = testGroup "biblatex"
|
||||
[
|
||||
]
|
||||
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
\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}
|
||||
\renewcommand\refname{References}
|
||||
\bibliography{biblio}
|
||||
|
||||
\end{document}
|
Loading…
Add table
Reference in a new issue