@@ -47,11 +47,13 @@ instance FromYAML Filter where
4747 parseYAML node =
4848 (withMap "Filter" $ \m -> do
4949 ty <- m .: "type"
50− fp <- m .: "path"
50+ fp <- m .:? "path"
51+ let missingPath = fail $ "Expected 'path' for filter of type " ++ show ty
52+ let filterWithPath constr = maybe missingPath (return . constr . T.unpack)
5153 case ty of
5254 "citeproc" -> return CiteprocFilter
53− "lua" -> return $ LuaFilter $ T.unpack fp
54− "json" -> return $ JSONFilter $ T.unpack fp
55+ "lua" -> filterWithPath LuaFilter fp
56+ "json" -> filterWithPath JSONFilter fp
5557 _ -> fail $ "Unknown filter type " ++ show (ty :: T.Text)) node
5658 <|>
5759 (withStr "Filter" $ \t -> do