Skip to content

Commit

Permalink
In parsing abbreviations JSON, ignore top-level fields...
Browse files Browse the repository at this point in the history
besides "default".  (E.g. "info" which is used in zotero's
defaults.)

Partially addresses #57.
  • Loading branch information
jgm committed Feb 22, 2021
1 parent 37bb7f9 commit bfab875
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Citeproc/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1608,12 +1608,8 @@ newtype Abbreviations =
deriving (Show, Eq, Ord)

instance FromJSON Abbreviations where
parseJSON (Object v) =
Abbreviations <$>
(parseJSON (Object v) >>= maybe
(fail "abbreviations lacks a default key")
return . M.lookup ("default" :: Text))
parseJSON _ = fail "Could not read abbreviations"
parseJSON = withObject "Abbreviations" $ \v ->
Abbreviations <$> v .: "default"

instance ToJSON Abbreviations where
toJSON (Abbreviations m) =
Expand Down

0 comments on commit bfab875

Please sign in to comment.