summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-09-15 19:19:47 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2012-09-15 19:19:47 -0400
commit0851f8d5923e88523b9be3ca300d96029b8b144d (patch)
tree48e1d015040964155789b2c0fc5ad24ce398b530
parent62225599c99135be386cde586937361abc8bde5f (diff)
Markdown writer: Made sensitive to Ext_hard_line_breaks.
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs12
1 files changed, 8 insertions, 4 deletions
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