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)
This commit is contained in:
John MacFarlane 2014-07-13 16:15:45 -07:00
parent 81088281de
commit 3e95fd586d
2 changed files with 10 additions and 3 deletions

View file

@ -153,7 +153,9 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
blockToDokuWiki opts (BlockQuote blocks) = do blockToDokuWiki opts (BlockQuote blocks) = do
contents <- blockListToDokuWiki opts blocks 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 blockToDokuWiki opts (Table capt aligns _ headers rows') = do
let alignStrings = map alignmentToString aligns let alignStrings = map alignmentToString aligns
@ -308,6 +310,10 @@ isPlainOrPara (Plain _) = True
isPlainOrPara (Para _) = True isPlainOrPara (Para _) = True
isPlainOrPara _ = False isPlainOrPara _ = False
isSimpleBlockQuote :: [Block] -> Bool
isSimpleBlockQuote [BlockQuote bs] = isSimpleBlockQuote bs
isSimpleBlockQuote [b] = isPlainOrPara b
isSimpleBlockQuote _ = False
-- | Concatenates strings with line breaks between them. -- | Concatenates strings with line breaks between them.
vcat :: [String] -> String vcat :: [String] -> String

View file

@ -47,7 +47,8 @@ E-mail style:
> This is a block quote. It is pretty short. > This is a block quote. It is pretty short.
> Code in a block quote: <HTML><blockquote>
Code in a block quote:
<code>sub status { <code>sub status {
print "working"; print "working";
@ -62,7 +63,7 @@ Nested block quotes:
> nested > nested
> nested > nested
</blockquote></HTML>
This should not be a block quote: 2 > 1. This should not be a block quote: 2 > 1.
And a following paragraph. And a following paragraph.