summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Biblio.hs2
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs18
-rw-r--r--tests/Tests/Old.hs2
3 files changed, 6 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs
index 4116e3cbd..4dd82dd08 100644
--- a/src/Text/Pandoc/Biblio.hs
+++ b/src/Text/Pandoc/Biblio.hs
@@ -54,7 +54,7 @@ processBiblio (Just style) r p =
cits_map = M.fromList $ zip grps (citations result)
biblioList = map (renderPandoc' style) (bibliography result)
Pandoc m b = bottomUp mvPunct . deNote . bottomUp (processCite style cits_map) $ p'
- in Pandoc m $ b ++ (RawBlock "pandoc" "references" : biblioList)
+ in Pandoc m $ b ++ biblioList
-- | Substitute 'Cite' elements with formatted citations.
processCite :: Style -> M.Map [Citation] [FormattedOutput] -> Inline -> Inline
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index bfd4c0898..f09cb3eec 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -61,8 +61,7 @@ writeMarkdown opts document =
evalState (pandocToMarkdown opts{
writerWrapText = writerWrapText opts &&
not (isEnabled Ext_hard_line_breaks opts) }
- document') def
- where document' = maybeRemoveBiblio opts document
+ document) def
-- | Convert Pandoc to plain text (like markdown, but without links,
-- pictures, or inline formatting).
@@ -72,16 +71,7 @@ writePlain opts document =
writerExtensions = Set.delete Ext_escaped_line_breaks $
writerExtensions opts }
document') def{ stPlain = True }
- where document' = plainify $ maybeRemoveBiblio opts document
-
--- If we're rendering citations as pandoc markdown citations,
--- then we don't want to include a bibliography.
-maybeRemoveBiblio :: WriterOptions -> Pandoc -> Pandoc
-maybeRemoveBiblio opts (Pandoc meta bs) = Pandoc meta bs'
- where bs' = if isEnabled Ext_citations opts
- then takeWhile
- (/= RawBlock "pandoc" "references") bs
- else bs
+ where document' = plainify document
plainify :: Pandoc -> Pandoc
plainify = bottomUp go
@@ -653,7 +643,7 @@ inlineToMarkdown opts (LineBreak)
| isEnabled Ext_escaped_line_breaks opts = return $ "\\" <> cr
| otherwise = return $ " " <> cr
inlineToMarkdown _ Space = return space
-inlineToMarkdown opts (Cite (c:cs) lst)
+inlineToMarkdown opts (Cite (c:cs) lst@[RawInline "latex" _])
| not (isEnabled Ext_citations opts) = inlineListToMarkdown opts lst
| citationMode c == AuthorInText = do
suffs <- inlineListToMarkdown opts $ citationSuffix c
@@ -680,7 +670,7 @@ inlineToMarkdown opts (Cite (c:cs) lst)
return $ pdoc <+> r
modekey SuppressAuthor = "-"
modekey _ = ""
-inlineToMarkdown _ (Cite _ _) = return $ text ""
+inlineToMarkdown opts (Cite _ lst) = inlineListToMarkdown opts lst
inlineToMarkdown opts (Link txt (src, tit)) = do
linktext <- inlineListToMarkdown opts txt
let linktitle = if null tit
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
index b6d95ca89..9e7493504 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-citations", "--bibliography",
+ ropts = ["-r", "markdown", "-w", "markdown", "--bibliography",
"biblio.bib", "--no-wrap"]
wopts = ["-r", "markdown", "-w", "markdown", "--no-wrap", "--natbib"]
styleToTest style = test style (ropts ++ ["--csl", style ++ ".csl"])