git.iko.soy/typeable/pandoc
on master help sign in
Dokuwiki writer: handle mixed lists without HTML fallback.

Closes #5107.

commit0d72237e274fcb054459f547b6a9e3c206f92c39 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 16 Jul 2019, 13:14 (7 years ago) parent100624a
2 files changed+31−20
src/Text/Pandoc/Writers/DokuWiki.hs+6−20 test/command/5107.md+25
src/Text/Pandoc/Writers/DokuWiki.hs+6−20
@@ -309,31 +309,17 @@ definitionListItemToDokuWiki opts (label, items) = do
309309isSimpleList :: Block -> Bool
310310isSimpleList x =
311311 case x of
312− BulletList items -> all isSimpleListItem items
313− OrderedList (num, sty, _) items -> all isSimpleListItem items &&
314− num == 1 && sty `elem` [DefaultStyle, Decimal]
315− DefinitionList items -> all isSimpleListItem $ concatMap snd items
316− _ -> False
312+ BulletList items -> all isSimpleListItem items
313+ OrderedList (1, _, _) items -> all isSimpleListItem items
314+ DefinitionList items -> all (all isSimpleListItem . snd) items
315+ _ -> False
317316
318317-- | True if list item can be handled with the simple wiki syntax. False if
319318-- HTML tags will be needed.
320319isSimpleListItem :: [Block] -> Bool
321320isSimpleListItem [] = True
322−isSimpleListItem [x] =
323− case x of
324− Plain _ -> True
325− Para _ -> True
326− BulletList _ -> isSimpleList x
327− OrderedList _ _ -> isSimpleList x
328− DefinitionList _ -> isSimpleList x
329− _ -> False
330−isSimpleListItem [x, y] | isPlainOrPara x =
331− case y of
332− BulletList _ -> isSimpleList y
333− OrderedList _ _ -> isSimpleList y
334− DefinitionList _ -> isSimpleList y
335− CodeBlock _ _ -> True
336− _ -> False
321+isSimpleListItem [x, CodeBlock{}] | isPlainOrPara x = True
322+isSimpleListItem (x:ys) | isPlainOrPara x = all isSimpleList ys
337323isSimpleListItem _ = False
338324
339325isPlainOrPara :: Block -> Bool
test/command/5107.mdnew file+25
@@ -0,0 +1,25 @@
1+```
2+% pandoc -f muse -t dokuwiki
3+ - foo
4+ 1. bar
5+ - baz
6+^D
7+ * foo
8+ - bar
9+ * baz
10+
11+
12+```
13+```
14+% pandoc -f muse -t dokuwiki
15+ - foo
16+ 1. bar
17+ 2. baz
18+^D
19+ * foo
20+ - bar
21+ - baz
22+
23+
24+```
25+