diff options
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 26 | ||||
-rw-r--r-- | test/command/5107.md | 25 |
2 files changed, 31 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 diff --git a/test/command/5107.md b/test/command/5107.md new file mode 100644 index 000000000..89f3e7a05 --- /dev/null +++ b/test/command/5107.md @@ -0,0 +1,25 @@ +``` +% pandoc -f muse -t dokuwiki + - foo + 1. bar + - baz +^D + * foo + - bar + * baz + + +``` +``` +% pandoc -f muse -t dokuwiki + - foo + 1. bar + 2. baz +^D + * foo + - bar + - baz + + +``` + |