Markdown writer: Made sensitive to Ext_hard_line_breaks.

This commit is contained in:
John MacFarlane 2012-09-15 19:19:47 -04:00
parent 62225599c9
commit 0851f8d592

View file

@ -54,7 +54,10 @@ data WriterState = WriterState { stNotes :: Notes
-- | Convert Pandoc to Markdown. -- | Convert Pandoc to Markdown.
writeMarkdown :: WriterOptions -> Pandoc -> String writeMarkdown :: WriterOptions -> Pandoc -> String
writeMarkdown opts document = writeMarkdown opts document =
evalState (pandocToMarkdown opts document) WriterState{ stNotes = [] evalState (pandocToMarkdown opts{
writerWrapText = writerWrapText opts &&
not (isEnabled Ext_hard_line_breaks opts) }
document) WriterState{ stNotes = []
, stRefs = [] , stRefs = []
, stPlain = False } , stPlain = False }
@ -588,6 +591,7 @@ inlineToMarkdown opts (RawInline f str)
return $ text str return $ text str
inlineToMarkdown _ (RawInline _ _) = return empty inlineToMarkdown _ (RawInline _ _) = return empty
inlineToMarkdown opts (LineBreak) inlineToMarkdown opts (LineBreak)
| isEnabled Ext_hard_line_breaks opts = return cr
| isEnabled Ext_escaped_line_breaks opts = return $ "\\" <> cr | isEnabled Ext_escaped_line_breaks opts = return $ "\\" <> cr
| otherwise = return $ " " <> cr | otherwise = return $ " " <> cr
inlineToMarkdown _ Space = return space inlineToMarkdown _ Space = return space