From ca5f4434c2652f778fab32cba6db6fc740c62cbb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 6 Nov 2011 16:48:16 -0800 Subject: Further simplification of Biblio. --- src/Text/Pandoc/Biblio.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs index 723c7ed10..c824f63c5 100644 --- a/src/Text/Pandoc/Biblio.hs +++ b/src/Text/Pandoc/Biblio.hs @@ -66,13 +66,14 @@ processBiblio cslfile r p processCite :: Style -> M.Map [Citation] [FormattedOutput] -> Inline -> [Inline] processCite s cs (Cite t _) = case M.lookup t cs of - Just x -> if isTextualCitation t - then renderPandoc s (take 1 x) ++ - case drop 1 x of - [] -> [] - ys -> [Space, Cite t $ renderPandoc s ys] - else [Cite t $ renderPandoc s x] - Nothing -> [Str ("Error processing " ++ show t)] + Just (x:xs) -> + if isTextualCitation t + then renderPandoc s [x] ++ + if null xs + then [] + else [Space, Cite t $ renderPandoc s xs] + else [Cite t $ renderPandoc s (x:xs)] + _ -> [Str ("Error processing " ++ show t)] processCite _ _ x = [x] isTextualCitation :: [Citation] -> Bool -- cgit v1.2.3