From 9aecc17c1d411a4cd5474dfd88968d06111f7811 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Tue, 2 Dec 2008 22:42:38 +0000 Subject: Markdown writer: proper handling of block quotes in lhs mode. If in lhs mode, put space before bird tracks for block quotes, to prevent them from being interpreted as literate Haskell source. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1502 788f1e2b-df1e-0410-8736-df70ead52e1b --- Text/Pandoc/Writers/Markdown.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Text') diff --git a/Text/Pandoc/Writers/Markdown.hs b/Text/Pandoc/Writers/Markdown.hs index 4b365773f..2b4ae8d0a 100644 --- a/Text/Pandoc/Writers/Markdown.hs +++ b/Text/Pandoc/Writers/Markdown.hs @@ -191,8 +191,13 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str) | "haskell" `elem` classes && blockToMarkdown opts (CodeBlock _ str) = return $ (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n" blockToMarkdown opts (BlockQuote blocks) = do + -- if we're writing literate haskell, put a space before the bird tracks + -- so they won't be interpreted as lhs... + let leader = if writerLiterateHaskell opts + then text . (" > " ++) + else text . ("> " ++) contents <- blockListToMarkdown opts blocks - return $ (vcat $ map (text . ("> " ++)) $ lines $ render contents) <> + return $ (vcat $ map leader $ lines $ render contents) <> text "\n" blockToMarkdown opts (Table caption aligns widths headers rows) = do caption' <- inlineListToMarkdown opts caption -- cgit v1.2.3