git.iko.soy/typeable/pandoc
on master help sign in
Text.Pandoc.Biblio: Expand citations recursively inside nested inlines.

Closes #331.

commitf4dbd853474e044c426e6c2fc293e6529ad517e0 authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 28 Oct 2011, 13:18 (15 years ago) parent565113f
1 file changed+5−7
src/Text/Pandoc/Biblio.hs+5−7
src/Text/Pandoc/Biblio.hs+5−7
@@ -64,13 +64,11 @@ processBiblio cslfile r p
6464
6565-- | Substitute 'Cite' elements with formatted citations.
6666processCite :: Style -> M.Map [Citation] [FormattedOutput] -> [Inline] -> [Inline]
67−processCite _ _ [] = []
68−processCite s cs (i:is)
69− | Cite t _ <- i = process t ++ processCite s cs is
70− | otherwise = i : processCite s cs is
71− where
72− addNt t x = if null x then [] else [Cite t $ renderPandoc s x]
73− process t = case M.lookup t cs of
67+processCite s cs = bottomUp (concatMap go)
68+ where go (Cite t _) = process t
69+ go x = [x]
70+ addNt t x = if null x then [] else [Cite t $ renderPandoc s x]
71+ process t = case M.lookup t cs of
7472 Just x -> if isTextualCitation t && x /= []
7573 then renderPandoc s [head x] ++
7674 if tail x /= []