Markdown writer: Fixed citations.

Previously the markdown writer printed raw citation codes, e.g.
[geach1970], rather than the expanded citations provided by citeproc,
e.g. (Geach 1970).  Now it prints the expanded citations.  This means
that the document produced can be processed as a markdown document
without citeproc.  Thanks to dsanson for reporting, and arossato
for the patch.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1871 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2010-03-07 19:36:00 +00:00
parent c2ce51e9f5
commit be34ad5b1d

View file

@ -351,13 +351,7 @@ inlineToMarkdown _ (TeX str) = return $ text str
inlineToMarkdown _ (HtmlInline str) = return $ text str
inlineToMarkdown _ (LineBreak) = return $ text " \n"
inlineToMarkdown _ Space = return $ char ' '
inlineToMarkdown _ (Cite cits _ ) = do
let format (a,b) xs = text a <>
(if b /= [] then char '@' else empty) <>
text b <>
(if isEmpty xs then empty else text "; ") <>
xs
return $ char '[' <> foldr format empty cits <> char ']'
inlineToMarkdown opts (Cite _ cits) = inlineListToMarkdown opts cits
inlineToMarkdown opts (Link txt (src, tit)) = do
linktext <- inlineListToMarkdown opts txt
let linktitle = if null tit then empty else text $ " \"" ++ tit ++ "\""