Markdown/RST reader: Skip blank lines.

This fixes a subtle regression involving grid tables with
empty cells.  Closes #732.

Also added test for grid table with empty cells.
This commit is contained in:
John MacFarlane 2013-01-27 22:13:05 -08:00
parent 9d549ab683
commit 72d11ad20b
4 changed files with 21 additions and 6 deletions

View file

@ -373,6 +373,7 @@ block = choice [ codeBlockFenced
, abbrevKey
, para
, plain
, mempty <$ blanklines
] <?> "block"
--
@ -807,7 +808,7 @@ para = try $ do
_ -> return $ B.para result'
plain :: MarkdownParser (F Blocks)
plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline <* spaces
plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline
--
-- raw html

View file

@ -143,6 +143,7 @@ block = choice [ codeBlock
, list
, lhsCodeBlock
, para
, mempty <$ blanklines
] <?> "block"
--

View file

@ -118,4 +118,10 @@
[[Plain [Str "b"]]
,[Plain [Str "b",Space,Str "2"]]
,[Plain [Str "b",Space,Str "2"]]]]
,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]]
,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
,Para [Str "Empty",Space,Str "cells"]
,Table [] [AlignDefault,AlignDefault] [5.555555555555555e-2,5.555555555555555e-2]
[[]
,[]]
[[[]
,[]]]]

View file

@ -196,8 +196,15 @@ Multiple blocks in a cell
+------------------+-----------+------------+
| # col 1 | # col 2 | # col 3 |
| col 1 | col 2 | col 3 |
+------------------+-----------+------------+
| r1 a | - b | c |
| | - b 2 | c 2 |
| r1 bis | - b 2 | c 2 |
+------------------+-----------+------------+
| r1 a | - b | c |
| | - b 2 | c 2 |
| r1 bis | - b 2 | c 2 |
+------------------+-----------+------------+
Empty cells
+---+---+
| | |
+---+---+