CslJson writer: output [] if no references in input,

instead of raising a PandocAppError as before.
This commit is contained in:
John MacFarlane 2021-01-30 18:10:22 -08:00
parent fe06437ba4
commit 6695917258

View file

@ -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