aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-11-24 20:23:06 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-11-24 20:23:06 -0800
commit33d328f1cf689fc0ceede285617cd027c768e422 (patch)
treebb0dd87b9855213a9a2b6659f1fbb0761191afae /src/Text/Pandoc
parentc73ae81628b77d8b5002e8216650dd8b449768b5 (diff)
downloadpandoc-33d328f1cf689fc0ceede285617cd027c768e422.tar.gz
Allow pipe tables with no body rows.
Previously this raised a runtime error. Closes #2556.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index d0c03062a..64cd817ba 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1341,9 +1341,10 @@ pipeTable :: MarkdownParser ([Alignment], [Double], F [Blocks], F [[Blocks]])
pipeTable = try $ do
nonindentSpaces
lookAhead nonspaceChar
- (heads,(aligns, seplengths)) <- (,) <$> pipeTableRow <*> pipeBreak
+ ((heads, rawHead),(aligns, seplengths)) <- (,) <$>
+ withRaw pipeTableRow <*> pipeBreak
(lines', rawRows) <- unzip <$> many (withRaw pipeTableRow)
- let maxlength = maximum $ map length rawRows
+ let maxlength = maximum $ map length (rawHead : rawRows)
numColumns <- getOption readerColumns
let widths = if maxlength > numColumns
then map (\len ->