git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: fixed tables with no body rows.

Previously these raised an exception. Closes #4513.

commitb9602766d8a3d6c8ed31c67f49cefa8bd1a6871a authorJohn MacFarlane <jgm@berkeley.edu> dateFri 30 Mar 2018, 14:56 (9 years ago) parentd0dc0c3
2 files changed+10−1
src/Text/Pandoc/Readers/Textile.hs+1−1 test/command/4513.md+9
src/Text/Pandoc/Readers/Textile.hs+1−1
@@ -395,7 +395,7 @@ table = try $ do
395395 (toprow:rest) | any (fst . fst) toprow ->
396396 (toprow, rest)
397397 _ -> (mempty, rawrows)
398− let nbOfCols = max (length headers) (length $ head rows)
398+ let nbOfCols = maximum $ map length (headers:rows)
399399 let aligns = map minimum $ transpose $ map (map (snd . fst)) (headers:rows)
400400 return $ B.table caption
401401 (zip aligns (replicate nbOfCols 0.0))
test/command/4513.mdnew file+9
@@ -0,0 +1,9 @@
1+```
2+% pandoc -f textile -t native
3+|_. heading 1 |_. heading 2|
4+^D
5+[Table [] [AlignDefault,AlignDefault] [0.0,0.0]
6+ [[Plain [Str "heading",Space,Str "1"]]
7+ ,[Plain [Str "heading",Space,Str "2"]]]
8+ []]
9+```