diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-08-02 21:35:02 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-08-02 21:35:02 -0700 |
commit | aef0f1d7c774c54f902c45f3df606851a56a995e (patch) | |
tree | 39b992d3f59abaed87fa8579c4d2061d8b2ae8b9 | |
parent | 03b1ba546f4f844887bccee799235c94a81734e4 (diff) | |
download | pandoc-aef0f1d7c774c54f902c45f3df606851a56a995e.tar.gz |
Made markdown writer sensitive to Ext_definition_lists.
IF not set, definition lists will be rendered as regular
paragraphs, with the term set off by a line break.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 5b2e0161e..d1c57b4b9 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -366,15 +366,20 @@ definitionListItemToMarkdown :: WriterOptions -> State WriterState Doc definitionListItemToMarkdown opts (label, defs) = do labelText <- inlineListToMarkdown opts label - let tabStop = writerTabStop opts - st <- get - let leader = if stPlain st then " " else ": " - let sps = case writerTabStop opts - 3 of - n | n > 0 -> text $ replicate n ' ' - _ -> text " " defs' <- mapM (mapM (blockToMarkdown opts)) defs - let contents = vcat $ map (\d -> hang tabStop (leader <> sps) $ vcat d <> cr) defs' - return $ nowrap labelText <> cr <> contents <> cr + if isEnabled Ext_definition_lists opts + then do + let tabStop = writerTabStop opts + st <- get + let leader = if stPlain st then " " else ": " + let sps = case writerTabStop opts - 3 of + n | n > 0 -> text $ replicate n ' ' + _ -> text " " + let contents = vcat $ map (\d -> hang tabStop (leader <> sps) $ vcat d <> cr) defs' + return $ nowrap labelText <> cr <> contents <> cr + else do + return $ nowrap labelText <> text " " <> cr <> + vsep (map vsep defs') <> blankline -- | Convert list of Pandoc block elements to markdown. blockListToMarkdown :: WriterOptions -- ^ Options |