diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-03-30 14:56:36 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-03-30 14:56:36 -0700 |
commit | b9602766d8a3d6c8ed31c67f49cefa8bd1a6871a (patch) | |
tree | 02b87231f008e032ed588795453650ffa3cc1782 | |
parent | d0dc0c353e9e11f1240d8e33c68151b500d62fe2 (diff) | |
download | pandoc-b9602766d8a3d6c8ed31c67f49cefa8bd1a6871a.tar.gz |
Textile reader: fixed tables with no body rows.
Previously these raised an exception.
Closes #4513.
-rw-r--r-- | src/Text/Pandoc/Readers/Textile.hs | 2 | ||||
-rw-r--r-- | test/command/4513.md | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs index 7eef1b4dc..bc3bcaf26 100644 --- a/src/Text/Pandoc/Readers/Textile.hs +++ b/src/Text/Pandoc/Readers/Textile.hs @@ -395,7 +395,7 @@ table = try $ do (toprow:rest) | any (fst . fst) toprow -> (toprow, rest) _ -> (mempty, rawrows) - let nbOfCols = max (length headers) (length $ head rows) + let nbOfCols = maximum $ map length (headers:rows) let aligns = map minimum $ transpose $ map (map (snd . fst)) (headers:rows) return $ B.table caption (zip aligns (replicate nbOfCols 0.0)) diff --git a/test/command/4513.md b/test/command/4513.md new file mode 100644 index 000000000..e4a4406e4 --- /dev/null +++ b/test/command/4513.md @@ -0,0 +1,9 @@ +``` +% pandoc -f textile -t native +|_. heading 1 |_. heading 2| +^D +[Table [] [AlignDefault,AlignDefault] [0.0,0.0] + [[Plain [Str "heading",Space,Str "1"]] + ,[Plain [Str "heading",Space,Str "2"]]] + []] +``` |