git.iko.soy/typeable/pandoc
on master help sign in
RST writer: Avoid stack overflow with certain tables.

Closes #1197. Note that there are still problems with the formatting of the tables inside tables with output produced from the input file in the original bug report. But this fixes the stack overflow problem.

commit814af2002e4837c160526123ef753bb34547d811 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 14 Mar 2014, 14:03 (13 years ago) parent76ef65f
1 file changed+6−2
src/Text/Pandoc/Writers/RST.hs+6−2
src/Text/Pandoc/Writers/RST.hs+6−2
@@ -219,11 +219,15 @@ blockToRST (Table caption _ widths headers rows) = do
219219 else blankline <> text "Table: " <> caption'
220220 headers' <- mapM blockListToRST headers
221221 rawRows <- mapM (mapM blockListToRST) rows
222− let isSimple = all (==0) widths && all (all (\bs -> length bs <= 1)) rows
222+ -- let isSimpleCell [Plain _] = True
223+ -- isSimpleCell [Para _] = True
224+ -- isSimpleCell [] = True
225+ -- isSimpleCell _ = False
226+ -- let isSimple = all (==0) widths && all (all isSimpleCell) rows
223227 let numChars = maximum . map offset
224228 opts <- get >>= return . stOptions
225229 let widthsInChars =
226− if isSimple
230+ if all (== 0) widths
227231 then map ((+2) . numChars) $ transpose (headers' : rawRows)
228232 else map (floor . (fromIntegral (writerColumns opts) *)) widths
229233 let hpipeBlocks blocks = hcat [beg, middle, end]