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:
parent
9d549ab683
commit
72d11ad20b
4 changed files with 21 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -143,6 +143,7 @@ block = choice [ codeBlock
|
|||
, list
|
||||
, lhsCodeBlock
|
||||
, para
|
||||
, mempty <$ blanklines
|
||||
] <?> "block"
|
||||
|
||||
--
|
||||
|
|
|
@ -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]
|
||||
[[]
|
||||
,[]]
|
||||
[[[]
|
||||
,[]]]]
|
||||
|
|
|
@ -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
|
||||
|
||||
+---+---+
|
||||
| | |
|
||||
+---+---+
|
||||
|
||||
|
|
Loading…
Reference in a new issue