diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-11 23:24:14 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-11 23:24:14 +0100 |
commit | d66b046c8a961dcb6ad08fa7ef5eea1864db4f9c (patch) | |
tree | c7ae4464b0a6399f27c229a07c4b5b67fb0a41d4 /src/Text/Pandoc/Writers | |
parent | be733385c9457a006da2b5d92fed0077401c3d1c (diff) | |
download | pandoc-d66b046c8a961dcb6ad08fa7ef5eea1864db4f9c.tar.gz |
Markdown writer: fixed bugs in simple/multiline list output.
* Previously we got overlong lists with `--wrap=none`. This is fixed.
* Previously a multiline list could become a simple list (and would
always become one with `--wrap=none`).
Closes #3384.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index ab986208d..8b58d5beb 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -673,15 +673,14 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do let minNumChars = (+ 2) . maximum . map minOffset let columns = transpose (rawHeaders : rawRows) -- minimal column width without wrapping a single word - let noWordWrapWidth - | writerWrapText opts == WrapAuto - = fromIntegral $ maximum (map minNumChars columns) - | otherwise = fromIntegral $ maximum (map numChars columns) - let relWidth w = floor $ max (fromIntegral (writerColumns opts) * w) - (noWordWrapWidth * w / minimum widths) + let relWidth w col = + max (floor $ fromIntegral (writerColumns opts) * w) + (if writerWrapText opts == WrapAuto + then minNumChars col + else numChars col) let widthsInChars | isSimple = map numChars columns - | otherwise = map relWidth widths + | otherwise = zipWith relWidth widths columns let makeRow = hcat . intersperse (lblock 1 (text " ")) . (zipWith3 alignHeader aligns widthsInChars) let rows' = map makeRow rawRows @@ -698,9 +697,9 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do let head'' = if headless then empty else border <> cr <> head' - let body = if maxRowHeight > 1 - then vsep rows' - else vcat rows' + let body = if isSimple + then vcat rows' + else vsep rows' let bottom = if headless then underline else border |