aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/BibTeX.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-11-17 23:12:32 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-11-17 23:12:32 -0800
commitefa34a8de67409a5604207e016b0a49e525c2db6 (patch)
tree5099b2e5aa0e0b67392996899118f12e01bc2f22 /src/Text/Pandoc/Readers/BibTeX.hs
parentbf3fea0a8cc65d140db55fc1af88be17d4df3e8b (diff)
downloadpandoc-efa34a8de67409a5604207e016b0a49e525c2db6.tar.gz
Bibtex reader: fall back on en-US if locale for LANG not found.
This reproduces earlier pandoc-citeproc behavior. Closes jgm/citeproc#26.
Diffstat (limited to 'src/Text/Pandoc/Readers/BibTeX.hs')
-rw-r--r--src/Text/Pandoc/Readers/BibTeX.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/BibTeX.hs b/src/Text/Pandoc/Readers/BibTeX.hs
index b7285e306..6c96ab30a 100644
--- a/src/Text/Pandoc/Readers/BibTeX.hs
+++ b/src/Text/Pandoc/Readers/BibTeX.hs
@@ -51,7 +51,10 @@ readBibTeX' variant _opts t = do
lang <- maybe (Lang "en" (Just "US")) parseLang
<$> lookupEnv "LANG"
locale <- case getLocale lang of
- Left e -> throwError $ PandocCiteprocError e
+ Left e ->
+ case getLocale (Lang "en" (Just "US")) of
+ Right l -> return l
+ Left _ -> throwError $ PandocCiteprocError e
Right l -> return l
case BibTeX.readBibtexString variant locale (const True) t of
Left e -> throwError $ PandocParsecError t e