aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Metadata.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-02-07 08:32:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-02-07 09:08:22 -0800
commit4c3db9273fc8e92c2c23d4455a6ab178472be06d (patch)
treecdfc8d65ebd56c0a571f8b46854465dd434489de /src/Text/Pandoc/Readers/Metadata.hs
parent6cd77d4c638012be63d66882403804aa28feb6ed (diff)
downloadpandoc-4c3db9273fc8e92c2c23d4455a6ab178472be06d.tar.gz
Apply linter suggestions. Add fix_spacing to lint target in Makefile.
Diffstat (limited to 'src/Text/Pandoc/Readers/Metadata.hs')
-rw-r--r--src/Text/Pandoc/Readers/Metadata.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/Metadata.hs b/src/Text/Pandoc/Readers/Metadata.hs
index 701e65980..23ceb40f9 100644
--- a/src/Text/Pandoc/Readers/Metadata.hs
+++ b/src/Text/Pandoc/Readers/Metadata.hs
@@ -40,8 +40,8 @@ yamlBsToMeta :: PandocMonad m
yamlBsToMeta pBlocks bstr = do
pos <- getPosition
case YAML.decodeNode' YAML.failsafeSchemaResolver False False bstr of
- Right ((YAML.Doc (YAML.Mapping _ _ o)):_)
- -> (fmap Meta) <$> yamlMap pBlocks o
+ Right (YAML.Doc (YAML.Mapping _ _ o):_)
+ -> fmap Meta <$> yamlMap pBlocks o
Right [] -> return . return $ mempty
Right [YAML.Doc (YAML.Scalar _ YAML.SNull)]
-> return . return $ mempty
@@ -84,12 +84,10 @@ toMetaValue pBlocks x =
asBlocks p = MetaBlocks . B.toList <$> p
checkBoolean :: Text -> Maybe Bool
-checkBoolean t =
- if t == T.pack "true" || t == T.pack "True" || t == T.pack "TRUE"
- then Just True
- else if t == T.pack "false" || t == T.pack "False" || t == T.pack "FALSE"
- then Just False
- else Nothing
+checkBoolean t
+ | t == T.pack "true" || t == T.pack "True" || t == T.pack "TRUE" = Just True
+ | t == T.pack "false" || t == T.pack "False" || t == T.pack "FALSE" = Just False
+ | otherwise = Nothing
yamlToMetaValue :: PandocMonad m
=> ParserT Text ParserState m (F Blocks)
@@ -133,4 +131,3 @@ yamlMap pBlocks o = do
return $ do
v' <- fv
return (k, v')
-