From 0851f8d5923e88523b9be3ca300d96029b8b144d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 15 Sep 2012 19:19:47 -0400 Subject: Markdown writer: Made sensitive to Ext_hard_line_breaks. --- src/Text/Pandoc/Writers/Markdown.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index d88419feb..1a0731710 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -54,9 +54,12 @@ data WriterState = WriterState { stNotes :: Notes -- | Convert Pandoc to Markdown. writeMarkdown :: WriterOptions -> Pandoc -> String writeMarkdown opts document = - evalState (pandocToMarkdown opts document) WriterState{ stNotes = [] - , stRefs = [] - , stPlain = False } + evalState (pandocToMarkdown opts{ + writerWrapText = writerWrapText opts && + not (isEnabled Ext_hard_line_breaks opts) } + document) WriterState{ stNotes = [] + , stRefs = [] + , stPlain = False } -- | Convert Pandoc to plain text (like markdown, but without links, -- pictures, or inline formatting). @@ -588,8 +591,9 @@ inlineToMarkdown opts (RawInline f str) return $ text str inlineToMarkdown _ (RawInline _ _) = return empty inlineToMarkdown opts (LineBreak) + | isEnabled Ext_hard_line_breaks opts = return cr | isEnabled Ext_escaped_line_breaks opts = return $ "\\" <> cr - | otherwise = return $ " " <> cr + | otherwise = return $ " " <> cr inlineToMarkdown _ Space = return space inlineToMarkdown opts (Cite (c:cs) lst) | writerCiteMethod opts == Citeproc = inlineListToMarkdown opts lst -- cgit v1.2.3