git.iko.soy/typeable/pandoc
on master help sign in
AsciiDoc writer: Correctly handle empty table cells.
fde52c2John MacFarlane
src/Text/Pandoc/Writers/AsciiDoc.hs+2−1
@@ -217,6 +217,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
217 let makeCell [Plain x] = do d <- blockListToAsciiDoc opts [Plain x]
217 let makeCell [Plain x] = do d <- blockListToAsciiDoc opts [Plain x]
218 return $ text "|" <> chomp d
218 return $ text "|" <> chomp d
219 makeCell [Para x] = makeCell [Plain x]
219 makeCell [Para x] = makeCell [Plain x]
220+ makeCell [] = return $ text "|"
220 makeCell _ = return $ text "|" <> "[multiblock cell omitted]"
221 makeCell _ = return $ text "|" <> "[multiblock cell omitted]"
221 let makeRow cells = hsep `fmap` mapM makeCell cells
222 let makeRow cells = hsep `fmap` mapM makeCell cells
222 rows' <- mapM makeRow rows
223 rows' <- mapM makeRow rows
@@ -227,7 +228,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
227 else 100000
228 else 100000
228 let maxwidth = maximum $ map offset (head':rows')
229 let maxwidth = maximum $ map offset (head':rows')
229 let body = if maxwidth > colwidth then vsep rows' else vcat rows'
230 let body = if maxwidth > colwidth then vsep rows' else vcat rows'
230− let border = text $ "|" ++ replicate ((min maxwidth colwidth) - 1) '='
231+ let border = text $ "|" ++ replicate (max 5 (min maxwidth colwidth) - 1) '='
231 return $
232 return $
232 caption'' $$ tablespec $$ border $$ head'' $$ body $$ border $$ blankline
233 caption'' $$ tablespec $$ border $$ head'' $$ body $$ border $$ blankline
233blockToAsciiDoc opts (BulletList items) = do
234blockToAsciiDoc opts (BulletList items) = do