aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-04 14:52:19 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-04 14:52:19 -0800
commitf3ac41937d732c3ff31b4cce47578dc9afd8836c (patch)
tree2a1f7821c6e85ff8fd80f6d0022bbafafbf99c50
parent0169e1034403273a3aa16a5c5d74a71f98705a85 (diff)
downloadpandoc-f3ac41937d732c3ff31b4cce47578dc9afd8836c.tar.gz
DokuWiki writer: Better handling of block quotes.
This change ensures that multiple paragraph blockquotes are rendered using native `>` rather than as HTML. Closes #1738.
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs6
-rw-r--r--tests/writer.dokuwiki5
2 files changed, 5 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index 8c1d360aa..74418aa7e 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -178,7 +178,7 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
blockToDokuWiki opts (BlockQuote blocks) = do
contents <- blockListToDokuWiki opts blocks
if isSimpleBlockQuote blocks
- then return $ "> " ++ contents
+ then return $ unlines $ map ("> " ++) $ lines contents
else return $ "<HTML><blockquote>\n" ++ contents ++ "</blockquote></HTML>"
blockToDokuWiki opts (Table capt aligns _ headers rows) = do
@@ -352,9 +352,7 @@ isPlainOrPara (Para _) = True
isPlainOrPara _ = False
isSimpleBlockQuote :: [Block] -> Bool
-isSimpleBlockQuote [BlockQuote bs] = isSimpleBlockQuote bs
-isSimpleBlockQuote [b] = isPlainOrPara b
-isSimpleBlockQuote _ = False
+isSimpleBlockQuote bs = all isPlainOrPara bs
-- | Concatenates strings with line breaks between them.
vcat :: [String] -> String
diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki
index 704e79b87..dc14e9b00 100644
--- a/tests/writer.dokuwiki
+++ b/tests/writer.dokuwiki
@@ -268,7 +268,8 @@ Multiple blocks with italics:
<HTML><dt></HTML>//orange//<HTML></dt></HTML>
<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>
<code>{ orange code block }</code>
-> <HTML><p></HTML>orange block quote<HTML></p></HTML><HTML></dd></HTML><HTML></dl></HTML>
+> <HTML><p></HTML>orange block quote<HTML></p></HTML>
+<HTML></dd></HTML><HTML></dl></HTML>
Multiple definitions, tight:
@@ -611,7 +612,7 @@ If you want, you can indent every line, but you can also be lazy and just indent
))
> Notes can go in quotes.((In quote.
-))
+> ))
- And in list items.((In list.))