From a796538d84e00f9512e64f1da5e7f147c8cfdbe0 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 5 Jan 2016 14:01:45 -0800
Subject: RST, Markdown writers: Fixed rendering of grid tables with blank
 rows.

Closes #2615.
---
 src/Text/Pandoc/Writers/Markdown.hs | 2 +-
 src/Text/Pandoc/Writers/RST.hs      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/Text/Pandoc')

diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 79a2dddf9..5a92f3cdf 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -572,7 +572,7 @@ gridTable opts headless _aligns widths headers' rawRows =  do
                    else widths
   let widthsInChars = map (floor . (fromIntegral (writerColumns opts) *)) widths'
   let hpipeBlocks blocks = hcat [beg, middle, end]
-        where h       = maximum (map height blocks)
+        where h       = maximum (1 : map height blocks)
               sep'    = lblock 3 $ vcat (map text $ replicate h " | ")
               beg     = lblock 2 $ vcat (map text $ replicate h "| ")
               end     = lblock 2 $ vcat (map text $ replicate h " |")
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 3b44a6cb0..98c39bdaf 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -267,7 +267,7 @@ blockToRST (Table caption _ widths headers rows) =  do
           then map ((+2) . numChars) $ transpose (headers' : rawRows)
           else map (floor . (fromIntegral (writerColumns opts) *)) widths
   let hpipeBlocks blocks = hcat [beg, middle, end]
-        where h      = maximum (map height blocks)
+        where h      = maximum (1 : map height blocks)
               sep'   = lblock 3 $ vcat (map text $ replicate h " | ")
               beg    = lblock 2 $ vcat (map text $ replicate h "| ")
               end    = lblock 2 $ vcat (map text $ replicate h " |")
-- 
cgit v1.2.3