Fix citeproc regression with duplicate references.

- Use dev version of citeproc, which handles duplicate
  ids better, preferring the last one in the list
  and discarding the rest.
- Ensure that inline citations take priority over external
  ones.

See jgm/citeproc#36.

This restores the behavior of pandoc-citeproc.
This commit is contained in:
John MacFarlane 2020-12-16 15:37:40 -08:00
parent 41577a6656
commit 914cf0b602
4 changed files with 11 additions and 10 deletions

View file

@ -9,8 +9,8 @@ source-repository-package
location: https://github.com/jgm/doctemplates.git
tag: 7ccbf7df16edbc7c5d835d955b242c61fd4e6601
-- source-repository-package
-- type: git
-- location: https://github.com/jgm/citeproc
-- tag: 42b1d154b02435229acbe98ae0f17d01b757ee93
source-repository-package
type: git
location: https://github.com/jgm/citeproc
tag: a8193fe375fa2354049bf9a967ba3bad4b1ba053

View file

@ -400,7 +400,7 @@ library
blaze-markup >= 0.8 && < 0.9,
bytestring >= 0.9 && < 0.12,
case-insensitive >= 1.2 && < 1.3,
citeproc >= 0.2.0.1 && < 0.3,
citeproc >= 0.3 && < 0.4,
commonmark >= 0.1.1.2 && < 0.2,
commonmark-extensions >= 0.2.0.4 && < 0.3,
commonmark-pandoc >= 0.2 && < 0.3,

View file

@ -119,7 +119,8 @@ processCitations (Pandoc meta bs) = do
Nothing -> return []
Nothing -> return []
let refs = map (linkifyVariables . legacyDateRanges)
(inlineRefs ++ externalRefs)
(externalRefs ++ inlineRefs)
-- note that inlineRefs can override externalRefs
let otherIdsMap = foldr (\ref m ->
case T.words . extractText <$>
M.lookup "other-ids"

View file

@ -20,10 +20,10 @@ extra-deps:
- doctemplates:
git: https://github.com/jgm/doctemplates.git
commit: 7ccbf7df16edbc7c5d835d955b242c61fd4e6601
- citeproc-0.2.0.1
# - citeproc:
# git: https://github.com/jgm/citeproc.git
# commit: 42b1d154b02435229acbe98ae0f17d01b757ee93
# - citeproc-0.2.0.1
- citeproc:
git: https://github.com/jgm/citeproc.git
commit: a8193fe375fa2354049bf9a967ba3bad4b1ba053
ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules
resolver: lts-16.23