git.iko.soy/typeable/pandoc
on master help sign in
DokuWiki reader: better handling for code block in list item.

Closes #3824.

commitced834076d8f4463c60a4f739a3d92a56d3e2183 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 2 Aug 2017, 10:33 (9 years ago) parent9932d52
2 files changed+22−2
src/Text/Pandoc/Writers/DokuWiki.hs+8−2 test/command/3824.md+14
src/Text/Pandoc/Writers/DokuWiki.hs+8−2
@@ -282,11 +282,16 @@ listAttribsToString (startnum, numstyle, _) =
282282listItemToDokuWiki :: PandocMonad m
283283 => WriterOptions -> [Block] -> DokuWiki m String
284284listItemToDokuWiki opts items = do
285− contents <- blockListToDokuWiki opts items
286285 useTags <- stUseTags <$> ask
287286 if useTags
288− then return $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>"
287+ then do
288+ contents <- blockListToDokuWiki opts items
289+ return $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>"
289290 else do
291+ bs <- mapM (blockToDokuWiki opts) items
292+ let contents = case items of
293+ [_, CodeBlock _ _] -> concat bs
294+ _ -> vcat bs
290295 indent <- stIndent <$> ask
291296 backSlash <- stBackSlashLB <$> ask
292297 let indent' = if backSlash then (drop 2 indent) else indent
@@ -351,6 +356,7 @@ isSimpleListItem [x, y] | isPlainOrPara x =
351356 BulletList _ -> isSimpleList y
352357 OrderedList _ _ -> isSimpleList y
353358 DefinitionList _ -> isSimpleList y
359+ CodeBlock _ _ -> True
354360 _ -> False
355361isSimpleListItem _ = False
356362
test/command/3824.mdnew file+14
@@ -0,0 +1,14 @@
1+```
2+% pandoc -f native -t dokuwiki
3+[BulletList
4+ [[Para [Str "hi"]
5+ ,CodeBlock ("",[],[]) " there"]
6+ ,[Para [Str "ok"]]]]
7+^D
8+ * hi<code>
9+ there
10+</code>
11+ * ok
12+
13+
14+```