From 69b030c7dfa0e7dc454cc589747f8fc7f5987510 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Wed, 7 Oct 2020 11:29:05 -0700
Subject: [PATCH] Cleaner solution to #6723.

---
 src/Text/Pandoc/Citeproc.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index a5cd26d18..2a71f619a 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -151,7 +151,7 @@ processCitations (Pandoc meta bs) = do
                       (resultBibliography result)
   let moveNotes = maybe True truish $
                         lookupMeta "notes-after-punctuation" meta
-  let cits = map (walk (convertQuotes locale)) $
+  let cits = map (walk fixLinks . walk (convertQuotes locale)) $
                resultCitations result
 
   let fixQuotes = case localePunctuationInQuote locale of
@@ -164,9 +164,9 @@ processCitations (Pandoc meta bs) = do
          walk (fixQuotes .  mvPunct moveNotes locale) $ walk deNote $
          evalState (walkM insertResolvedCitations $ Pandoc meta' bs)
          $ cits
-  return $ walk fixLinks
-         $ Pandoc meta''
-         $ insertRefs refkvs classes meta'' (B.toList bibs) bs'
+  return $ Pandoc meta''
+         $ insertRefs refkvs classes meta''
+            (walk fixLinks $ B.toList bibs) bs'
 
 -- If we have a span.csl-left-margin followed by span.csl-right-inline,
 -- we insert a space. This ensures that they will be separated by a space,