aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Biblio.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs
index 3182d7d0b..76fc5ee6d 100644
--- a/src/Text/Pandoc/Biblio.hs
+++ b/src/Text/Pandoc/Biblio.hs
@@ -64,13 +64,11 @@ processBiblio cslfile r p
-- | Substitute 'Cite' elements with formatted citations.
processCite :: Style -> M.Map [Citation] [FormattedOutput] -> [Inline] -> [Inline]
-processCite _ _ [] = []
-processCite s cs (i:is)
- | Cite t _ <- i = process t ++ processCite s cs is
- | otherwise = i : processCite s cs is
- where
- addNt t x = if null x then [] else [Cite t $ renderPandoc s x]
- process t = case M.lookup t cs of
+processCite s cs = bottomUp (concatMap go)
+ where go (Cite t _) = process t
+ go x = [x]
+ addNt t x = if null x then [] else [Cite t $ renderPandoc s x]
+ process t = case M.lookup t cs of
Just x -> if isTextualCitation t && x /= []
then renderPandoc s [head x] ++
if tail x /= []