summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Biblio.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-10-28 13:18:58 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-10-28 13:18:58 -0700
commitf4dbd853474e044c426e6c2fc293e6529ad517e0 (patch)
tree5b186d1f43f5babdeeb48f4100202fc3218fd428 /src/Text/Pandoc/Biblio.hs
parent565113fb6b91ecaf1827110a53df923d9ef36789 (diff)
Text.Pandoc.Biblio: Expand citations recursively inside nested inlines.
Closes #331.
Diffstat (limited to 'src/Text/Pandoc/Biblio.hs')
-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 /= []