diff options
author | mb21 <mb21@users.noreply.github.com> | 2018-09-15 12:46:59 +0200 |
---|---|---|
committer | mb21 <mb21@users.noreply.github.com> | 2018-09-15 12:46:59 +0200 |
commit | 700f7a141f94616734b08df291b44e7a7ae64991 (patch) | |
tree | 86d423b0e64b94751d8995fe3a97f1285788e8d0 /src/Text/Pandoc/Readers | |
parent | bd5500ba7f80632143e41a5fc70b29f9722d5f6c (diff) | |
download | pandoc-700f7a141f94616734b08df291b44e7a7ae64991.tar.gz |
Markdown Reader: rename yamlToMeta to yamlToMetaValue
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index a81942a9e..2ab61f90e 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -249,7 +249,7 @@ yamlMetaBlock = try $ do if ignorable k then return () else do - v' <- yamlToMeta v + v' <- yamlToMetaValue v let k' = T.unpack k updateState $ \st -> st{ stateMeta' = do m <- stateMeta' st @@ -309,9 +309,9 @@ checkBoolean t = then Just False else Nothing -yamlToMeta :: PandocMonad m - => YAML.Node -> MarkdownParser m (F MetaValue) -yamlToMeta (YAML.Scalar x) = +yamlToMetaValue :: PandocMonad m + => YAML.Node -> MarkdownParser m (F MetaValue) +yamlToMetaValue (YAML.Scalar x) = case x of YAML.SStr t -> toMetaValue t YAML.SBool b -> return $ return $ MetaBool b @@ -322,25 +322,25 @@ yamlToMeta (YAML.Scalar x) = Just b -> return $ return $ MetaBool b Nothing -> toMetaValue t YAML.SNull -> return $ return $ MetaString "" -yamlToMeta (YAML.Sequence _ xs) = do - xs' <- mapM yamlToMeta xs +yamlToMetaValue (YAML.Sequence _ xs) = do + xs' <- mapM yamlToMetaValue xs return $ do xs'' <- sequence xs' return $ B.toMetaValue xs'' -yamlToMeta (YAML.Mapping _ o) = +yamlToMetaValue (YAML.Mapping _ o) = foldM (\m (key, v) -> do k <- nodeToKey key if ignorable k then return m else do - v' <- yamlToMeta v + v' <- yamlToMetaValue v return $ do MetaMap m' <- m v'' <- v' return (MetaMap $ M.insert (T.unpack k) v'' m')) (return $ MetaMap M.empty) (M.toList o) -yamlToMeta _ = return $ return $ MetaString "" +yamlToMetaValue _ = return $ return $ MetaString "" stopLine :: PandocMonad m => MarkdownParser m () stopLine = try $ (string "---" <|> string "...") >> blankline >> return () |