diff options
| author | John MacFarlane <[email protected]> | 2024-11-08 09:27:00 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-11-08 09:28:49 -0800 |
| commit | b088a55e56b68390adb14fcb5da6441dc7c68ca7 (patch) | |
| tree | ac2ffeef791248332d5f2dd63c87f6c017a255c7 /src | |
| parent | a863c30ac1ca25d27d6a95e59494d11532a677f1 (diff) | |
Docx reader: handle case where Zotero itemData has different id...
from the citationItem id. In this case we use the citationItemId
in the bibliography as well, overriding the referenceId in the itemData.
Closes #10366.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 689ee9f7c..af8d7555a 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -539,7 +539,15 @@ handleCitation citation = do let items = Citeproc.citationItems citation let cs = map toPandocCitation items refs <- mapM (traverse (return . text)) $ - mapMaybe Citeproc.citationItemData items + 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 modify $ \st -> st{ docxReferences = foldr (\ref -> M.insert (referenceId ref) ref) |
