aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Lua')
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/AST.hs4
-rw-r--r--src/Text/Pandoc/Lua/Module/Utils.hs5
2 files changed, 3 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Lua/Marshaling/AST.hs b/src/Text/Pandoc/Lua/Marshaling/AST.hs
index 7a75047ae..679dd1f46 100644
--- a/src/Text/Pandoc/Lua/Marshaling/AST.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/AST.hs
@@ -230,9 +230,7 @@ peekCaption idx = do
instance Peekable ColWidth where
peek idx = do
width <- Lua.fromOptional <$> Lua.peek idx
- return $ case width of
- Nothing -> ColWidthDefault
- Just w -> ColWidth w
+ return $ maybe ColWidthDefault ColWidth width
instance Pushable ColWidth where
push = \case
diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs
index 4fe5e255d..988489a2a 100644
--- a/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -50,9 +50,8 @@ pushModule = do
-- | Squashes a list of blocks into inlines.
blocksToInlines :: [Block] -> Lua.Optional [Inline] -> PandocLua [Inline]
blocksToInlines blks optSep = liftPandocLua $ do
- let sep = case Lua.fromOptional optSep of
- Just x -> B.fromList x
- Nothing -> Shared.defaultBlocksSeparator
+ let sep = maybe Shared.defaultBlocksSeparator B.fromList
+ $ Lua.fromOptional optSep
return $ B.toList (Shared.blocksToInlinesWithSep sep blks)
-- | Convert list of Pandoc blocks into sections using Divs.