git.iko.soy/typeable/pandoc
on master help sign in
DokuWiki writer: Better handling of block quotes.
f3ac419John MacFarlane
src/Text/Pandoc/Writers/DokuWiki.hs+2−4
@@ -178,7 +178,7 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
178blockToDokuWiki opts (BlockQuote blocks) = do
178blockToDokuWiki opts (BlockQuote blocks) = do
179 contents <- blockListToDokuWiki opts blocks
179 contents <- blockListToDokuWiki opts blocks
180 if isSimpleBlockQuote blocks
180 if isSimpleBlockQuote blocks
181− then return $ "> " ++ contents
181+ then return $ unlines $ map ("> " ++) $ lines contents
182 else return $ "<HTML><blockquote>\n" ++ contents ++ "</blockquote></HTML>"
182 else return $ "<HTML><blockquote>\n" ++ contents ++ "</blockquote></HTML>"
183
183
184blockToDokuWiki opts (Table capt aligns _ headers rows) = do
184blockToDokuWiki opts (Table capt aligns _ headers rows) = do
@@ -352,9 +352,7 @@ isPlainOrPara (Para _) = True
352isPlainOrPara _ = False
352isPlainOrPara _ = False
353
353
354isSimpleBlockQuote :: [Block] -> Bool
354isSimpleBlockQuote :: [Block] -> Bool
355−isSimpleBlockQuote [BlockQuote bs] = isSimpleBlockQuote bs
355+isSimpleBlockQuote bs = all isPlainOrPara bs
356−isSimpleBlockQuote [b] = isPlainOrPara b
357−isSimpleBlockQuote _ = False
358
356
359-- | Concatenates strings with line breaks between them.
357-- | Concatenates strings with line breaks between them.
360vcat :: [String] -> String
358vcat :: [String] -> String
tests/writer.dokuwiki+3−2
@@ -268,7 +268,8 @@ Multiple blocks with italics:
268<HTML><dt></HTML>//orange//<HTML></dt></HTML>
268<HTML><dt></HTML>//orange//<HTML></dt></HTML>
269<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>
269<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>
270<code>{ orange code block }</code>
270<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>
272
273
273Multiple definitions, tight:
274Multiple definitions, tight:
274
275
@@ -611,7 +612,7 @@ If you want, you can indent every line, but you can also be lazy and just indent
611))
612))
612
613
613> Notes can go in quotes.((In quote.
614> Notes can go in quotes.((In quote.
614−))
615+> ))
615
616
616 - And in list items.((In list.))
617 - And in list items.((In list.))
617
618