mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-29 01:41:20 +08:00
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.
This commit is contained in:
+15
-14
@@ -105,20 +105,21 @@ processCitations (Pandoc meta bs) = do
|
||||
let idpred = if "*" `Set.member` nocites
|
||||
then const True
|
||||
else (`Set.member` citeIds)
|
||||
refs <- map (linkifyVariables . legacyDateRanges) <$>
|
||||
case lookupMeta "references" meta of
|
||||
Just (MetaList rs) -> return $ mapMaybe metaValueToReference rs
|
||||
_ ->
|
||||
case lookupMeta "bibliography" meta of
|
||||
Just (MetaList xs) ->
|
||||
mconcat <$>
|
||||
mapM (getRefsFromBib locale idpred)
|
||||
(mapMaybe metaValueToText xs)
|
||||
Just x ->
|
||||
case metaValueToText x of
|
||||
Just fp -> getRefsFromBib locale idpred fp
|
||||
Nothing -> return []
|
||||
Nothing -> return []
|
||||
let inlineRefs = case lookupMeta "references" meta of
|
||||
Just (MetaList rs) -> mapMaybe metaValueToReference rs
|
||||
_ -> []
|
||||
externalRefs <- case lookupMeta "bibliography" meta of
|
||||
Just (MetaList xs) ->
|
||||
mconcat <$>
|
||||
mapM (getRefsFromBib locale idpred)
|
||||
(mapMaybe metaValueToText xs)
|
||||
Just x ->
|
||||
case metaValueToText x of
|
||||
Just fp -> getRefsFromBib locale idpred fp
|
||||
Nothing -> return []
|
||||
Nothing -> return []
|
||||
let refs = map (linkifyVariables . legacyDateRanges)
|
||||
(inlineRefs ++ externalRefs)
|
||||
let otherIdsMap = foldr (\ref m ->
|
||||
case T.words . extractText <$>
|
||||
M.lookup "other-ids"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
```
|
||||
% pandoc --citeproc -t plain --bibliography command/biblio.bib
|
||||
---
|
||||
references:
|
||||
- id: foo
|
||||
title: Crazy
|
||||
type: book
|
||||
...
|
||||
|
||||
[@foo; @item1]
|
||||
|
||||
^D
|
||||
(Crazy, n.d.; Doe 2005)
|
||||
|
||||
Crazy. n.d.
|
||||
|
||||
Doe, John. 2005. First Book. Cambridge: Cambridge University Press.
|
||||
```
|
||||
Reference in New Issue
Block a user