aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Man.hs24
-rw-r--r--test/command/6858.md52
2 files changed, 71 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs
index e87d07bd9..21b8feaab 100644
--- a/src/Text/Pandoc/Readers/Man.hs
+++ b/src/Text/Pandoc/Readers/Man.hs
@@ -407,12 +407,14 @@ parseBlockQuote = blockQuote <$> continuation
data ListType = Ordered ListAttributes
| Bullet
+ | Definition T.Text
listTypeMatches :: Maybe ListType -> ListType -> Bool
listTypeMatches Nothing _ = True
listTypeMatches (Just Bullet) Bullet = True
listTypeMatches (Just (Ordered (_,x,y))) (Ordered (_,x',y'))
= x == x' && y == y'
+listTypeMatches (Just (Definition _)) (Definition _) = True
listTypeMatches (Just _) _ = False
listItem :: PandocMonad m => Maybe ListType -> ManParser m (ListType, Blocks)
@@ -427,20 +429,28 @@ listItem mbListType = try $ do
Right (start, listtype, listdelim)
| cs == cs' -> Ordered (start, listtype, listdelim)
| otherwise -> Ordered (start, listtype, DefaultDelim)
- Left _ -> Bullet
+ Left _
+ | cs == "\183" || cs == "-" || cs == "*" || cs == "+"
+ -> Bullet
+ | otherwise -> Definition cs
guard $ listTypeMatches mbListType lt
+ skipMany memptyLine
inls <- option mempty parseInlines
+ skipMany memptyLine
continuations <- mconcat <$> many continuation
return (lt, para inls <> continuations)
[] -> mzero
parseList :: PandocMonad m => ManParser m Blocks
parseList = try $ do
- (lt, x) <- listItem Nothing
- xs <- map snd <$> many (listItem (Just lt))
+ x@(lt, _) <- listItem Nothing
+ xs <- many (listItem (Just lt))
+ let toDefItem (Definition t, bs) = (B.text t, [bs])
+ toDefItem _ = mempty
return $ case lt of
- Bullet -> bulletList (x:xs)
- Ordered lattr -> orderedListWith lattr (x:xs)
+ Bullet -> bulletList $ map snd (x:xs)
+ Ordered lattr -> orderedListWith lattr $ map snd (x:xs)
+ Definition _ -> definitionList $ map toDefItem (x:xs)
continuation :: PandocMonad m => ManParser m Blocks
continuation =
@@ -453,11 +463,15 @@ definitionListItem :: PandocMonad m
=> ManParser m (Inlines, [Blocks])
definitionListItem = try $ do
mmacro "TP" -- args specify indent level, can ignore
+ skipMany memptyLine
term <- parseInline
+ skipMany memptyLine
moreterms <- many $ try $ do
mmacro "TQ"
parseInline
+ skipMany memptyLine
inls <- option mempty parseInlines
+ skipMany memptyLine
continuations <- mconcat <$> many continuation
return ( mconcat (intersperse B.linebreak (term:moreterms))
, [para inls <> continuations])
diff --git a/test/command/6858.md b/test/command/6858.md
new file mode 100644
index 000000000..53cb9bddb
--- /dev/null
+++ b/test/command/6858.md
@@ -0,0 +1,52 @@
+```
+% pandoc -t markdown -f man
+.TH FvwmAnimate 1 "Date" Fvwm "Fvwm Modules"
+.UC
+.SH NAME
+\fBFvwmAnimate\fP \- the fvwm animate module
+.SH SYNOPSIS
+Module FvwmAnimate [ModuleAlias]
+
+.IP "*FvwmAnimate: Color \fBcolor\fP"
+
+Tells \fBFvwmAnimate\fP what color to draw with.
+The color is "XOR'ed" (exclusive ORed) onto the background.
+
+.IP "*FvwmAnimate: Pixmap \fBpixmap\fP"
+
+Tells \fBFvwmAnimate\fP to use \fBpixmap\fP to draw with. This can be useful
+if \fB*FvwmAnimate: Color\fP gives poor results.
+^D
+# NAME
+
+**FvwmAnimate** - the fvwm animate module
+
+# SYNOPSIS
+
+Module FvwmAnimate \[ModuleAlias\]
+
+\*FvwmAnimate: Color color
+
+: Tells **FvwmAnimate** what color to draw with. The color is
+ \"XOR\'ed\" (exclusive ORed) onto the background.
+
+\*FvwmAnimate: Pixmap pixmap
+
+: Tells **FvwmAnimate** to use **pixmap** to draw with. This can be
+ useful if **\*FvwmAnimate: Color** gives poor results.
+```
+
+```
+% pandoc -t markdown -f man
+.IP "\[bu]"
+
+hi
+
+.IP "\[bu]"
+
+there
+^D
+- hi
+
+- there
+```