From ced834076d8f4463c60a4f739a3d92a56d3e2183 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 2 Aug 2017 10:33:08 -0700 Subject: DokuWiki reader: better handling for code block in list item. Closes #3824. --- src/Text/Pandoc/Writers/DokuWiki.hs | 10 ++++++++-- test/command/3824.md | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/command/3824.md diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index ad8689e8c..279475a21 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -282,11 +282,16 @@ listAttribsToString (startnum, numstyle, _) = listItemToDokuWiki :: PandocMonad m => WriterOptions -> [Block] -> DokuWiki m String listItemToDokuWiki opts items = do - contents <- blockListToDokuWiki opts items useTags <- stUseTags <$> ask if useTags - then return $ "
  • " ++ contents ++ "
  • " + then do + contents <- blockListToDokuWiki opts items + return $ "
  • " ++ contents ++ "
  • " else do + bs <- mapM (blockToDokuWiki opts) items + let contents = case items of + [_, CodeBlock _ _] -> concat bs + _ -> vcat bs indent <- stIndent <$> ask backSlash <- stBackSlashLB <$> ask let indent' = if backSlash then (drop 2 indent) else indent @@ -351,6 +356,7 @@ isSimpleListItem [x, y] | isPlainOrPara x = BulletList _ -> isSimpleList y OrderedList _ _ -> isSimpleList y DefinitionList _ -> isSimpleList y + CodeBlock _ _ -> True _ -> False isSimpleListItem _ = False diff --git a/test/command/3824.md b/test/command/3824.md new file mode 100644 index 000000000..e479e9e2f --- /dev/null +++ b/test/command/3824.md @@ -0,0 +1,14 @@ +``` +% pandoc -f native -t dokuwiki +[BulletList + [[Para [Str "hi"] + ,CodeBlock ("",[],[]) " there"] + ,[Para [Str "ok"]]]] +^D + * hi + there + + * ok + + +``` -- cgit v1.2.3