diff options
| author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-05 07:47:09 +0000 | 
|---|---|---|
| committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-05 07:47:09 +0000 | 
| commit | 61f7a4f8698e9d9eb7a8af6ab8253815415156e7 (patch) | |
| tree | 500795c92f75bd9718b6615e8f0cc4e8800678d7 /src | |
| parent | da6291d930487055726c128b1d09e074c5db5ad3 (diff) | |
| download | pandoc-61f7a4f8698e9d9eb7a8af6ab8253815415156e7.tar.gz | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index c6926e3c1..7d758d9ed 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -728,7 +728,17 @@ widthsFromIndices :: Int      -- Number of columns on terminal                    -> [Double] -- Fractional relative sizes of columns  widthsFromIndices _ [] = []    widthsFromIndices numColumns indices =  -  let lengths = zipWith (-) indices (0:indices) +  let lengths' = zipWith (-) indices (0:indices) +      lengths  = reverse $ +                 case reverse lengths' of +                      []       -> [] +                      [x]      -> [x] +                      -- compensate for the fact that intercolumn +                      -- spaces are counted in widths of all columns +                      -- but the last... +                      (x:y:zs) -> if x < y && y - x <= 2 +                                     then y:y:zs +                                     else x:y:zs        totLength = sum lengths        quotient = if totLength > numColumns                     then fromIntegral totLength | 
