mirror of
https://github.com/srid/rib.git
synced 2024-11-26 13:50:31 +03:00
Remove error from mkDoc (Pandoc)
This commit is contained in:
parent
7f9a25e0d6
commit
f8014e92f0
@ -62,7 +62,7 @@ instance Markup Pandoc where
|
||||
$ detectReader k
|
||||
withExcept RibPandocError_PandocError $
|
||||
mkDoc k
|
||||
<$> parsePure r s
|
||||
=<< parsePure r s
|
||||
|
||||
readDoc (Arg k) (Arg f) = runExceptT $ do
|
||||
content <- readFileText $ toFilePath f
|
||||
@ -71,7 +71,7 @@ instance Markup Pandoc where
|
||||
detectReader k
|
||||
withExceptT RibPandocError_PandocError $
|
||||
mkDoc k
|
||||
<$> parse r content
|
||||
=<< parse r content
|
||||
|
||||
showMarkupError = toText @String . show
|
||||
|
||||
@ -188,13 +188,10 @@ detectReader f = do
|
||||
-- MonadError instead.
|
||||
catchInMonadError ef = either (throwError . ef) pure
|
||||
|
||||
mkDoc :: Path Rel File -> Pandoc -> Document Pandoc
|
||||
mkDoc f v = Document f v h $ getMetadata v
|
||||
where
|
||||
h =
|
||||
either (error . showMarkupError @Pandoc) id
|
||||
$ first RibPandocError_PandocError
|
||||
$ render' v
|
||||
mkDoc :: MonadError PandocError m => Path Rel File -> Pandoc -> m (Document Pandoc)
|
||||
mkDoc f v = do
|
||||
h <- liftEither $ render' v
|
||||
pure $ Document f v h $ getMetadata v
|
||||
|
||||
getMetadata :: Pandoc -> Maybe Value
|
||||
getMetadata (Pandoc meta _) = flattenMeta meta
|
||||
|
Loading…
Reference in New Issue
Block a user