From 48d83b6ffedb052831a10f9c2d66626f2383a1a7 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sat, 14 Dec 2024 03:22:35 -0500 Subject: [PATCH] Remove several unnecessary layers of indirection from refs --- src/Text/Pandoc/Readers/Docx.hs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index a9e53eb39390..7abbc461d0a9 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -547,16 +547,12 @@ handleCitation citation = do , citationHash = 0 } let items = Citeproc.citationItems citation let cs = map toPandocCitation items - refs <- mapM (traverse (return . text)) $ - mapMaybe (\item -> - case Citeproc.citationItemData item of - Nothing -> Nothing - Just itemData -> - -- see #10366, sometimes itemData has a different - -- id and we need to use the same one: - Just $ itemData{ referenceId = - Citeproc.citationItemId item }) - items + let refs = mapMaybe (\item -> fmap (\itemData -> text <$> + -- see #10366, sometimes itemData has a different + -- id and we need to use the same one: + itemData{ referenceId = + Citeproc.citationItemId item }) + (Citeproc.citationItemData item)) items modify $ \st -> st{ docxReferences = foldr (\ref -> M.insert (referenceId ref) ref)