From 4262898fe9cc71abecffc1ffa165dd714c04407d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 28 Jun 2021 13:28:02 -0700 Subject: [PATCH] Set proper initial source name in parsing BibTeX. (For better error messages.) --- src/Text/Pandoc/Citeproc/BibTeX.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs index b17240557..1fe4a2730 100644 --- a/src/Text/Pandoc/Citeproc/BibTeX.hs +++ b/src/Text/Pandoc/Citeproc/BibTeX.hs @@ -71,9 +71,11 @@ readBibtexString variant locale idpred contents = do filter (\item -> idpred (identifier item) && entryType item /= "xdata")) (fromMaybe defaultLang $ localeLanguage locale, Map.empty) - "" (toSources contents) of + (initialSourceName sources) sources of Left err -> Left err Right xs -> return xs + where + sources = toSources contents -- | Write BibTeX or BibLaTeX given given a 'Reference'. writeBibtexString :: WriterOptions -- ^ options (for writing LaTex)