Markdown writer: Made sensitive to Ext_hard_line_breaks.
This commit is contained in:
parent
62225599c9
commit
0851f8d592
1 changed files with 8 additions and 4 deletions
|
@ -54,9 +54,12 @@ 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{
|
||||||
, stRefs = []
|
writerWrapText = writerWrapText opts &&
|
||||||
, stPlain = False }
|
not (isEnabled Ext_hard_line_breaks opts) }
|
||||||
|
document) WriterState{ stNotes = []
|
||||||
|
, stRefs = []
|
||||||
|
, stPlain = False }
|
||||||
|
|
||||||
-- | Convert Pandoc to plain text (like markdown, but without links,
|
-- | Convert Pandoc to plain text (like markdown, but without links,
|
||||||
-- pictures, or inline formatting).
|
-- pictures, or inline formatting).
|
||||||
|
@ -588,8 +591,9 @@ 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
|
||||||
inlineToMarkdown opts (Cite (c:cs) lst)
|
inlineToMarkdown opts (Cite (c:cs) lst)
|
||||||
| writerCiteMethod opts == Citeproc = inlineListToMarkdown opts lst
|
| writerCiteMethod opts == Citeproc = inlineListToMarkdown opts lst
|
||||||
|
|
Loading…
Reference in a new issue