From 3e95fd586dfc286cb1bb7300521ccd2a6d11bc1f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 13 Jul 2014 16:15:45 -0700 Subject: [PATCH] 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) --- src/Text/Pandoc/Writers/DokuWiki.hs | 8 +++++++- tests/writer.dokuwiki | 5 +++-- 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 $ "
\n" ++ contents ++ "
" 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: +
+Code in a block quote: sub status { print "working"; @@ -62,7 +63,7 @@ Nested block quotes: > nested > nested - +
This should not be a block quote: 2 > 1. And a following paragraph.