aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-07-16 13:14:37 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-16 13:14:37 -0700
commit0d72237e274fcb054459f547b6a9e3c206f92c39 (patch)
tree6f30b3c68ede522803ee79ceb3edeeefef608a6e /src/Text/Pandoc
parent100624a00914ff869046d61f248b4b6ab8868a66 (diff)
downloadpandoc-0d72237e274fcb054459f547b6a9e3c206f92c39.tar.gz
Dokuwiki writer: handle mixed lists without HTML fallback.
Closes #5107.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index 2630e60e5..4cd6c9c7c 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -309,31 +309,17 @@ definitionListItemToDokuWiki opts (label, items) = do
isSimpleList :: Block -> Bool
isSimpleList x =
case x of
- BulletList items -> all isSimpleListItem items
- OrderedList (num, sty, _) items -> all isSimpleListItem items &&
- num == 1 && sty `elem` [DefaultStyle, Decimal]
- DefinitionList items -> all isSimpleListItem $ concatMap snd items
- _ -> False
+ BulletList items -> all isSimpleListItem items
+ OrderedList (1, _, _) items -> all isSimpleListItem items
+ DefinitionList items -> all (all isSimpleListItem . snd) items
+ _ -> False
-- | True if list item can be handled with the simple wiki syntax. False if
-- HTML tags will be needed.
isSimpleListItem :: [Block] -> Bool
isSimpleListItem [] = True
-isSimpleListItem [x] =
- case x of
- Plain _ -> True
- Para _ -> True
- BulletList _ -> isSimpleList x
- OrderedList _ _ -> isSimpleList x
- DefinitionList _ -> isSimpleList x
- _ -> False
-isSimpleListItem [x, y] | isPlainOrPara x =
- case y of
- BulletList _ -> isSimpleList y
- OrderedList _ _ -> isSimpleList y
- DefinitionList _ -> isSimpleList y
- CodeBlock _ _ -> True
- _ -> False
+isSimpleListItem [x, CodeBlock{}] | isPlainOrPara x = True
+isSimpleListItem (x:ys) | isPlainOrPara x = all isSimpleList ys
isSimpleListItem _ = False
isPlainOrPara :: Block -> Bool