git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: Compensate for width of final table column.

Resolves Issue #144. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1649 788f1e2b-df1e-0410-8736-df70ead52e1b

commit61f7a4f8698e9d9eb7a8af6ab8253815415156e7 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 5 Dec 2009, 07:47 (17 years ago) parentda6291d
1 file changed+11−1
src/Text/Pandoc/Readers/Markdown.hs+11−1
src/Text/Pandoc/Readers/Markdown.hs+11−1
@@ -728,7 +728,17 @@ widthsFromIndices :: Int -- Number of columns on terminal
728728 -> [Double] -- Fractional relative sizes of columns
729729widthsFromIndices _ [] = []
730730widthsFromIndices numColumns indices =
731− let lengths = zipWith (-) indices (0:indices)
731+ let lengths' = zipWith (-) indices (0:indices)
732+ lengths = reverse $
733+ case reverse lengths' of
734+ [] -> []
735+ [x] -> [x]
736+ -- compensate for the fact that intercolumn
737+ -- spaces are counted in widths of all columns
738+ -- but the last...
739+ (x:y:zs) -> if x < y && y - x <= 2
740+ then y:y:zs
741+ else x:y:zs
732742 totLength = sum lengths
733743 quotient = if totLength > numColumns
734744 then fromIntegral totLength