git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: fixed bugs in simple/multiline list output.
d66b046John MacFarlane
src/Text/Pandoc/Writers/Markdown.hs+9−10
@@ -673,15 +673,14 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do
673 let minNumChars = (+ 2) . maximum . map minOffset
673 let minNumChars = (+ 2) . maximum . map minOffset
674 let columns = transpose (rawHeaders : rawRows)
674 let columns = transpose (rawHeaders : rawRows)
675 -- minimal column width without wrapping a single word
675 -- minimal column width without wrapping a single word
676− let noWordWrapWidth
676+ let relWidth w col =
677+ max (floor $ fromIntegral (writerColumns opts) * w)
677− | writerWrapText opts == WrapAuto
678+ (if writerWrapText opts == WrapAuto
678− = fromIntegral $ maximum (map minNumChars columns)
679+ then minNumChars col
679− | otherwise = fromIntegral $ maximum (map numChars columns)
680+ else numChars col)
680− let relWidth w = floor $ max (fromIntegral (writerColumns opts) * w)
681− (noWordWrapWidth * w / minimum widths)
682 let widthsInChars
681 let widthsInChars
683 | isSimple = map numChars columns
682 | isSimple = map numChars columns
684− | otherwise = map relWidth widths
683+ | otherwise = zipWith relWidth widths columns
685 let makeRow = hcat . intersperse (lblock 1 (text " ")) .
684 let makeRow = hcat . intersperse (lblock 1 (text " ")) .
686 (zipWith3 alignHeader aligns widthsInChars)
685 (zipWith3 alignHeader aligns widthsInChars)
687 let rows' = map makeRow rawRows
686 let rows' = map makeRow rawRows
@@ -698,9 +697,9 @@ pandocTable opts headless aligns widths rawHeaders rawRows = do
698 let head'' = if headless
697 let head'' = if headless
699 then empty
698 then empty
700 else border <> cr <> head'
699 else border <> cr <> head'
701− let body = if maxRowHeight > 1
700+ let body = if isSimple
701+ then vcat rows'
702− then vsep rows'
702+ else vsep rows'
703− else vcat rows'
704 let bottom = if headless
703 let bottom = if headless
705 then underline
704 then underline
706 else border
705 else border
test/command/3384.mdnew file+15
@@ -0,0 +1,15 @@
1+```
2+% pandoc -t markdown --wrap=none
3+ ----- ------------------------------------------------
4+ foo bar
5+
6+ foo this is a long
7+ line of text
8+ ----- ------------------------------------------------
9+^D
10+ ------ ------------------------------------------------
11+ foo bar
12+
13+ foo this is a long line of text
14+ ------ ------------------------------------------------
15+```