aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-01-30 18:10:22 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-01-30 18:10:22 -0800
commit66959172588409becb42993bb94ea106ac3e5606 (patch)
tree2cedc73f8600edebaa00f0e328e6a17c5f1f68bb /src/Text/Pandoc/Writers
parentfe06437ba4ef12782078ac05c6f9c917f32d51f0 (diff)
downloadpandoc-66959172588409becb42993bb94ea106ac3e5606.tar.gz
CslJson writer: output `[]` if no references in input,
instead of raising a PandocAppError as before.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/CslJson.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/CslJson.hs b/src/Text/Pandoc/Writers/CslJson.hs
index 13b95586b..f0defdd38 100644
--- a/src/Text/Pandoc/Writers/CslJson.hs
+++ b/src/Text/Pandoc/Writers/CslJson.hs
@@ -46,11 +46,11 @@ writeCslJson _opts (Pandoc meta _) = do
locale <- case getLocale lang of
Left e -> throwError $ PandocCiteprocError e
Right l -> return l
- case lookupMeta "references" meta of
- Just (MetaList rs) -> return $ (UTF8.toText $
- toCslJson locale (mapMaybe metaValueToReference rs))
- <> "\n"
- _ -> throwError $ PandocAppError "No references field"
+ let rs = case lookupMeta "references" meta of
+ Just (MetaList rs) -> rs
+ _ -> []
+ return $ UTF8.toText
+ (toCslJson locale (mapMaybe metaValueToReference rs)) <> "\n"
fromInlines :: [Inline] -> CslJson Text
fromInlines = foldMap fromInline . B.fromList