aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-07-13 16:15:45 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-07-13 16:15:45 -0700
commit3e95fd586dfc286cb1bb7300521ccd2a6d11bc1f (patch)
tree80386ef50e02b499b1ce942542bff946ce838ced
parent81088281dea1283159f7e0cf3d9c2a5082e06d8a (diff)
downloadpandoc-3e95fd586dfc286cb1bb7300521ccd2a6d11bc1f.tar.gz
Use raw HTML for complex block quotes.
As far as I can see, dokuwiki markup is pretty limited in what can go in a `>` block quote: just a single line of paragraph text. (#1398)
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs8
-rw-r--r--tests/writer.dokuwiki5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index aef247164..26f9b5f62 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -153,7 +153,9 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
blockToDokuWiki opts (BlockQuote blocks) = do
contents <- blockListToDokuWiki opts blocks
- return $ "> " ++ contents
+ if isSimpleBlockQuote blocks
+ then return $ "> " ++ contents
+ else return $ "<HTML><blockquote>\n" ++ contents ++ "</blockquote></HTML>"
blockToDokuWiki opts (Table capt aligns _ headers rows') = do
let alignStrings = map alignmentToString aligns
@@ -308,6 +310,10 @@ isPlainOrPara (Plain _) = True
isPlainOrPara (Para _) = True
isPlainOrPara _ = False
+isSimpleBlockQuote :: [Block] -> Bool
+isSimpleBlockQuote [BlockQuote bs] = isSimpleBlockQuote bs
+isSimpleBlockQuote [b] = isPlainOrPara b
+isSimpleBlockQuote _ = False
-- | Concatenates strings with line breaks between them.
vcat :: [String] -> String
diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki
index e1844d62a..9801ed262 100644
--- a/tests/writer.dokuwiki
+++ b/tests/writer.dokuwiki
@@ -47,7 +47,8 @@ E-mail style:
> This is a block quote. It is pretty short.
-> Code in a block quote:
+<HTML><blockquote>
+Code in a block quote:
<code>sub status {
print "working";
@@ -62,7 +63,7 @@ Nested block quotes:
> nested
> nested
-
+</blockquote></HTML>
This should not be a block quote: 2 > 1.
And a following paragraph.