git.iko.soy/typeable/pandoc
on master help sign in
Fix handling of xdata in bibtex/biblatex bibliographies.

Closes #6752.

commiteb3307da4e53097da52997e276c08b188ed40960 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 15 Oct 2020, 17:41 (6 years ago) parent988d381
2 files changed+38−2
src/Text/Pandoc/Citeproc/BibTeX.hs+2−2 test/command/6752.md+36
src/Text/Pandoc/Citeproc/BibTeX.hs+2−2
@@ -61,7 +61,8 @@ readBibtexString :: Variant -- ^ bibtex or biblatex
6161readBibtexString variant locale idpred contents = do
6262 case runParser (((resolveCrossRefs variant <$> bibEntries) <* eof) >>=
6363 mapM (itemToReference locale variant) .
64− filter (idpred . identifier))
64+ filter (\item -> idpred (identifier item) &&
65+ entryType item /= "xdata"))
6566 (fromMaybe defaultLang $ localeLanguage locale, Map.empty)
6667 "" contents of
6768 Left err -> Left err
@@ -1058,7 +1059,6 @@ getTypeAndGenre :: Bib (Text, Maybe Text)
10581059getTypeAndGenre = do
10591060 lang <- gets localeLang
10601061 et <- asks entryType
1061− guard $ et /= "xdata"
10621062 reftype' <- resolveKey' lang <$> getRawField "type"
10631063 <|> return mempty
10641064 st <- getRawField "entrysubtype" <|> return mempty
test/command/6752.mdnew file+36
@@ -0,0 +1,36 @@
1+```
2+% pandoc -f biblatex -t csljson
3+@xdata{XDPubAlfredAKnopf,
4+    publisher   = {Alfred A.~Knopf},
5+    address     = {New York, NY}
6+}
7+@book{Klinkenborg2012,
8+    author      = {Verlyn Klinkenborg},
9+    title       = {Several short sentences about writing},
10+    date        = {2012},
11+    xdata       = {XDPubAlfredAKnopf},
12+}
13+^D
14+[
15+ {
16+ "author": [
17+ {
18+ "family": "Klinkenborg",
19+ "given": "Verlyn"
20+ }
21+ ],
22+ "id": "Klinkenborg2012",
23+ "issued": {
24+ "date-parts": [
25+ [
26+ 2012
27+ ]
28+ ]
29+ },
30+ "publisher": "Alfred A. Knopf",
31+ "publisher-place": "New York, NY",
32+ "title": "Several short sentences about writing",
33+ "type": "book"
34+ }
35+]
36+```