Fix regression in citeproc processing.

If inline references are used (in the metadata `references` field),
we should still only include in the bibliography items that are
actually cited -- unless `nocite` is used.

Closes #7376.
This commit is contained in:
John MacFarlane 2021-06-12 10:16:44 -07:00
parent ea88979aa2
commit b0cd6c6224
3 changed files with 21 additions and 8 deletions

View file

@ -194,7 +194,9 @@ getReferences mblocale (Pandoc meta bs) = do
then const True
else (`Set.member` citeIds)
let inlineRefs = case lookupMeta "references" meta of
Just (MetaList rs) -> mapMaybe metaValueToReference rs
Just (MetaList rs) ->
filter (idpred . unItemId . referenceId)
$ mapMaybe metaValueToReference rs
_ -> []
externalRefs <- case lookupMeta "bibliography" meta of
Just (MetaList xs) ->

16
test/command/7376.md Normal file
View file

@ -0,0 +1,16 @@
```
% pandoc --citeproc -t plain
---
references:
- id: item1
type: book
author:
- family: Doe
given: Jane
issued: 2020
title: The title
...
^D
```

View file

@ -15,11 +15,6 @@ references:
[@bar]
^D
(Alice 2042)
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-foo .csl-entry}
Alice. 2042.
:::
:::
[WARNING] Citeproc: citation bar not found
(**bar?**)
```