summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Man.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-08-07 21:18:50 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-07 21:18:50 -0700
commit5064241b24888b325836d4912085e916fe45080b (patch)
treee3755c02b9a8e9bf6e7229959f1af67841189520 /src/Text/Pandoc/Writers/Man.hs
parent2c0e989f9df788b7f168159fd99d5c3e1a78aa85 (diff)
Man writer: avoid error for def lists with no definitions.
Closes #3832.
Diffstat (limited to 'src/Text/Pandoc/Writers/Man.hs')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 4e756c419..8d677600d 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -305,15 +305,18 @@ definitionListItemToMan opts (label, defs) = do
labelText <- inlineListToMan opts label
contents <- if null defs
then return empty
- else liftM vcat $ forM defs $ \blocks -> do
- (first, rest) <- case blocks of
- ((Para x):y) -> return (Plain x,y)
- (x:y) -> return (x,y)
- [] -> throwError $ PandocSomeError "blocks is null"
- rest' <- liftM vcat $
- mapM (\item -> blockToMan opts item) rest
- first' <- blockToMan opts first
- return $ first' $$ text ".RS" $$ rest' $$ text ".RE"
+ else liftM vcat $ forM defs $ \blocks ->
+ case blocks of
+ (x:xs) -> do
+ first' <- blockToMan opts $
+ case x of
+ Para y -> Plain y
+ _ -> x
+ rest' <- liftM vcat $ mapM
+ (\item -> blockToMan opts item) xs
+ return $ first' $$
+ text ".RS" $$ rest' $$ text ".RE"
+ [] -> return empty
return $ text ".TP" $$ nowrap (text ".B " <> labelText) $$ contents
-- | Convert list of Pandoc block elements to man.