diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-08-02 10:33:08 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-08-02 10:33:08 -0700 |
commit | ced834076d8f4463c60a4f739a3d92a56d3e2183 (patch) | |
tree | ab2b5f8136867cf1268fa460c4d54d02a76f6ba1 | |
parent | 9932d52b535143a55fc8d34f5f4d1a1841ed7259 (diff) | |
download | pandoc-ced834076d8f4463c60a4f739a3d92a56d3e2183.tar.gz |
DokuWiki reader: better handling for code block in list item.
Closes #3824.
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 10 | ||||
-rw-r--r-- | test/command/3824.md | 14 |
2 files changed, 22 insertions, 2 deletions
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 $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>" + then do + contents <- blockListToDokuWiki opts items + return $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>" 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<code> + there +</code> + * ok + + +``` |