git.iko.soy/typeable/pandoc
on master help sign in
DokuWiki writer: Better handling of block quotes.

This change ensures that multiple paragraph blockquotes are rendered using native `>` rather than as HTML. Closes #1738.

commitf3ac41937d732c3ff31b4cce47578dc9afd8836c authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 4 Nov 2014, 14:52 (12 years ago) parent0169e10
2 files changed+5−6
src/Text/Pandoc/Writers/DokuWiki.hs+2−4 tests/writer.dokuwiki+3−2
src/Text/Pandoc/Writers/DokuWiki.hs+2−4
@@ -178,7 +178,7 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
178178blockToDokuWiki opts (BlockQuote blocks) = do
179179 contents <- blockListToDokuWiki opts blocks
180180 if isSimpleBlockQuote blocks
181− then return $ "> " ++ contents
181+ then return $ unlines $ map ("> " ++) $ lines contents
182182 else return $ "<HTML><blockquote>\n" ++ contents ++ "</blockquote></HTML>"
183183
184184blockToDokuWiki opts (Table capt aligns _ headers rows) = do
@@ -352,9 +352,7 @@ isPlainOrPara (Para _) = True
352352isPlainOrPara _ = False
353353
354354isSimpleBlockQuote :: [Block] -> Bool
355−isSimpleBlockQuote [BlockQuote bs] = isSimpleBlockQuote bs
356−isSimpleBlockQuote [b] = isPlainOrPara b
357−isSimpleBlockQuote _ = False
355+isSimpleBlockQuote bs = all isPlainOrPara bs
358356
359357-- | Concatenates strings with line breaks between them.
360358vcat :: [String] -> String
tests/writer.dokuwiki+3−2
@@ -268,7 +268,8 @@ Multiple blocks with italics:
268268<HTML><dt></HTML>//orange//<HTML></dt></HTML>
269269<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>
270270<code>{ orange code block }</code>
271−> <HTML><p></HTML>orange block quote<HTML></p></HTML><HTML></dd></HTML><HTML></dl></HTML>
271+> <HTML><p></HTML>orange block quote<HTML></p></HTML>
272+<HTML></dd></HTML><HTML></dl></HTML>
272273
273274Multiple definitions, tight:
274275
@@ -611,7 +612,7 @@ If you want, you can indent every line, but you can also be lazy and just indent
611612))
612613
613614> Notes can go in quotes.((In quote.
614−))
615+> ))
615616
616617 - And in list items.((In list.))
617618