git.iko.soy/typeable/pandoc
on master help sign in
Allow both inline and external references to be used

with `--citeproc`. This fixes a regression, since pandoc-citeproc allowed these to be combined. Closes #6951.

commit7d799bfcda749e4a3ad6fcae59ac5ccb80b77ffd authorJohn MacFarlane <jgm@berkeley.edu> dateTue 15 Dec 2020, 08:51 (6 years ago) parent03c897c
2 files changed+33−14
src/Text/Pandoc/Citeproc.hs+15−14 test/command/6951.md+18
src/Text/Pandoc/Citeproc.hs+15−14
@@ -105,20 +105,21 @@ processCitations (Pandoc meta bs) = do
105105 let idpred = if "*" `Set.member` nocites
106106 then const True
107107 else (`Set.member` citeIds)
108− refs <- map (linkifyVariables . legacyDateRanges) <$>
109− case lookupMeta "references" meta of
110− Just (MetaList rs) -> return $ mapMaybe metaValueToReference rs
111− _ ->
112− case lookupMeta "bibliography" meta of
113− Just (MetaList xs) ->
114− mconcat <$>
115− mapM (getRefsFromBib locale idpred)
116− (mapMaybe metaValueToText xs)
117− Just x ->
118− case metaValueToText x of
119− Just fp -> getRefsFromBib locale idpred fp
120− Nothing -> return []
121− Nothing -> return []
108+ let inlineRefs = case lookupMeta "references" meta of
109+ Just (MetaList rs) -> mapMaybe metaValueToReference rs
110+ _ -> []
111+ externalRefs <- case lookupMeta "bibliography" meta of
112+ Just (MetaList xs) ->
113+ mconcat <$>
114+ mapM (getRefsFromBib locale idpred)
115+ (mapMaybe metaValueToText xs)
116+ Just x ->
117+ case metaValueToText x of
118+ Just fp -> getRefsFromBib locale idpred fp
119+ Nothing -> return []
120+ Nothing -> return []
121+ let refs = map (linkifyVariables . legacyDateRanges)
122+ (inlineRefs ++ externalRefs)
122123 let otherIdsMap = foldr (\ref m ->
123124 case T.words . extractText <$>
124125 M.lookup "other-ids"
test/command/6951.mdnew file+18
@@ -0,0 +1,18 @@
1+```
2+% pandoc --citeproc -t plain --bibliography command/biblio.bib
3+---
4+references:
5+- id: foo
6+ title: Crazy
7+ type: book
8+...
9+
10+[@foo; @item1]
11+
12+^D
13+(Crazy, n.d.; Doe 2005)
14+
15+Crazy. n.d.
16+
17+Doe, John. 2005. First Book. Cambridge: Cambridge University Press.
18+```