diff options
| -rw-r--r-- | src/Text/Pandoc/Writers/Shared.hs | 12 | ||||
| -rw-r--r-- | test/command/3526.md | 14 | 
2 files changed, 21 insertions, 5 deletions
| diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs index 7e08724d8..615733a78 100644 --- a/src/Text/Pandoc/Writers/Shared.hs +++ b/src/Text/Pandoc/Writers/Shared.hs @@ -230,8 +230,11 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do    let numcols = maximum (length aligns : length widths :                             map length (headers:rows))    let handleGivenWidths widths' = do -        let widthsInChars' = map ((\x -> x - 3) . floor . -                      (fromIntegral (writerColumns opts) *)) widths' +        let widthsInChars' = map ( +                      (\x -> if x < 1 then 1 else x) . +                      (\x -> x - 3) . floor . +                      (fromIntegral (writerColumns opts) *) +                      ) widths'          rawHeaders' <- zipWithM blocksToDoc              (map (\w -> opts{writerColumns =                        min (w - 2) (writerColumns opts)}) widthsInChars') @@ -268,11 +271,10 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do    let head' = makeRow rawHeaders    let rows' = map (makeRow . map chomp) rawRows    let borderpart ch align widthInChars = -        let widthInChars' = if widthInChars < 1 then 1 else widthInChars -        in (if (align == AlignLeft || align == AlignCenter) +           (if (align == AlignLeft || align == AlignCenter)                 then char ':'                 else char ch) <> -           text (replicate widthInChars' ch) <> +           text (replicate widthInChars ch) <>             (if (align == AlignRight || align == AlignCenter)                 then char ':'                 else char ch) diff --git a/test/command/3526.md b/test/command/3526.md new file mode 100644 index 000000000..e197bcf32 --- /dev/null +++ b/test/command/3526.md @@ -0,0 +1,14 @@ +``` +% pandoc -t rst ++--+---+ +|  |   | ++--+---+ +|  |   | ++--+---+ +^D ++---+---+ +|   |   | ++---+---+ +|   |   | ++---+---+ +``` | 
