diff --git a/pandoc.cabal b/pandoc.cabal index af805b6bf..7f82d11a1 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -109,7 +109,6 @@ Extra-Source-Files: tests/lalune.jpg, tests/movie.jpg, tests/biblio.bib, - tests/biblio.mods, tests/chicago-author-date.csl, tests/ieee.csl, tests/mhra.csl, @@ -384,7 +383,6 @@ Test-Suite test-pandoc QuickCheck >= 2.4 && < 2.7, HUnit >= 1.2 && < 1.3, containers >= 0.1 && < 0.6, - citeproc-hs >= 0.3 && < 0.4, ansi-terminal >= 0.5 && < 0.7 Other-Modules: Tests.Old Tests.Helpers diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 880997a6d..5a2ab599b 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1021,10 +1021,7 @@ cites mode multi = try $ do citation :: String -> CitationMode -> Bool -> LP Inlines citation name mode multi = do (c,raw) <- withRaw $ cites mode multi - refs <- getOption readerReferences - return $ if null refs - then rawInline "latex" $ "\\" ++ name ++ raw - else cite c mempty + return $ cite c (rawInline "latex" $ "\\" ++ name ++ raw) complexNatbibCitation :: CitationMode -> LP Inlines complexNatbibCitation mode = try $ do @@ -1043,10 +1040,8 @@ complexNatbibCitation mode = try $ do optional $ char ';' return $ addPrefix pref $ addSuffix suff $ cits' (c:cits, raw) <- withRaw $ grouped parseOne - refs <- getOption readerReferences - return $ if null refs - then rawInline "latex" $ "\\citetext" ++ raw - else cite (c{ citationMode = mode}:cits) mempty + return $ cite (c{ citationMode = mode }:cits) + (rawInline "latex" $ "\\citetext" ++ raw) -- tables diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 876485552..b496c8011 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -644,8 +644,7 @@ inlineToMarkdown opts (LineBreak) | otherwise = return $ " " <> cr inlineToMarkdown _ Space = return space inlineToMarkdown opts (Cite (c:cs) lst) - | not (null lst) = inlineListToMarkdown opts lst - -- if lst is null, citeproc wasn't run; print a pandoc markdown citation + | not (isEnabled Ext_citations opts) = inlineListToMarkdown opts lst | citationMode c == AuthorInText = do suffs <- inlineListToMarkdown opts $ citationSuffix c rest <- mapM convertOne cs diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs index 9e7493504..b6d95ca89 100644 --- a/tests/Tests/Old.hs +++ b/tests/Tests/Old.hs @@ -186,7 +186,7 @@ markdownCitationTests ++ [test "natbib" wopts "markdown-citations.txt" "markdown-citations.txt"] where - ropts = ["-r", "markdown", "-w", "markdown", "--bibliography", + ropts = ["-r", "markdown", "-w", "markdown-citations", "--bibliography", "biblio.bib", "--no-wrap"] wopts = ["-r", "markdown", "-w", "markdown", "--no-wrap", "--natbib"] styleToTest style = test style (ropts ++ ["--csl", style ++ ".csl"]) diff --git a/tests/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs index 016281ccb..271b32689 100644 --- a/tests/Tests/Readers/LaTeX.hs +++ b/tests/Tests/Readers/LaTeX.hs @@ -2,20 +2,14 @@ module Tests.Readers.LaTeX (tests) where import Text.Pandoc.Definition -import Data.Monoid (mempty) -import Text.CSL (Reference, readBiblioFile) import Test.Framework import Tests.Helpers import Tests.Arbitrary() import Text.Pandoc.Builder import Text.Pandoc -import System.IO.Unsafe (unsafePerformIO) - -refs :: [Reference] -refs = unsafePerformIO $ readBiblioFile "biblio.mods" latex :: String -> Pandoc -latex = readLaTeX def{ readerReferences = refs } +latex = readLaTeX def infix 4 =: (=:) :: ToString c @@ -77,7 +71,7 @@ baseCitation = Citation{ citationId = "item1" } rt :: String -> Inlines -rt = const mempty -- rawInline "latex" +rt = rawInline "latex" natbibCitations :: Test natbibCitations = testGroup "natbib" diff --git a/tests/biblio.mods b/tests/biblio.mods deleted file mode 100644 index 478439419..000000000 --- a/tests/biblio.mods +++ /dev/null @@ -1,106 +0,0 @@ - - - - - First Book - - - John - Doe - - author - - - - monographic - 2005 - Cambridge University Press - - Cambridge - - - text - book - item1 - - - - Article - - - John - Doe - - author - - - - 2006 - - text - - - Journal of Generic Studies - - - continuing - - periodical - academic journal - - item2 - - 2006 - 6 - - 33 - 34 - - - - - - Why Water Is Wet - - - John - Doe - - author - - - - Jenny - Roe - - author - - - - monographic - 2007 - - text - - - Third Book - - - Sam - Smith - - editor - - - - 2007 - Oxford University Press - - Oxford - - - collection - - пункт3 - - diff --git a/tests/latex-reader.native b/tests/latex-reader.native index f225e0969..28bbad89c 100644 --- a/tests/latex-reader.native +++ b/tests/latex-reader.native @@ -260,7 +260,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,HorizontalRule ,Header 1 ("",[],[]) [Str "LaTeX"] ,BulletList - [[Para [RawInline "latex" "\\cite[22-23]{smith.1899}"]] + [[Para [Cite [Citation {citationId = "smith.1899", citationPrefix = [], citationSuffix = [Str ",",Space,Str "22-23"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [RawInline "latex" "\\cite[22-23]{smith.1899}"]]] ,[Para [RawInline "latex" "\\doublespacing"]] ,[Para [Math InlineMath "2+2=4"]] ,[Para [Math InlineMath "x \\in y"]]