git.iko.soy/typeable/pandoc
on master help sign in
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.

commit72d11ad20bd5f291c373b1aeb09cc869905b0f26 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 27 Jan 2013, 22:13 (14 years ago) parent9d549ab
4 files changed+20−5
src/Text/Pandoc/Readers/Markdown.hs+2−1 src/Text/Pandoc/Readers/RST.hs+1 tests/markdown-reader-more.native+7−1 tests/markdown-reader-more.txt+10−3
src/Text/Pandoc/Readers/Markdown.hs+2−1
@@ -373,6 +373,7 @@ block = choice [ codeBlockFenced
373373 , abbrevKey
374374 , para
375375 , plain
376+ , mempty <$ blanklines
376377 ] <?> "block"
377378
378379--
@@ -807,7 +808,7 @@ para = try $ do
807808 _ -> return $ B.para result'
808809
809810plain :: MarkdownParser (F Blocks)
810−plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline <* spaces
811+plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline
811812
812813--
813814-- raw html
src/Text/Pandoc/Readers/RST.hs+1
@@ -143,6 +143,7 @@ block = choice [ codeBlock
143143 , list
144144 , lhsCodeBlock
145145 , para
146+ , mempty <$ blanklines
146147 ] <?> "block"
147148
148149--
tests/markdown-reader-more.native+7−1
@@ -118,4 +118,10 @@
118118 [[Plain [Str "b"]]
119119 ,[Plain [Str "b",Space,Str "2"]]
120120 ,[Plain [Str "b",Space,Str "2"]]]]
121− ,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]]
121+ ,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
122+,Para [Str "Empty",Space,Str "cells"]
123+,Table [] [AlignDefault,AlignDefault] [5.555555555555555e-2,5.555555555555555e-2]
124+ [[]
125+ ,[]]
126+ [[[]
127+ ,[]]]]
tests/markdown-reader-more.txt+10−3
@@ -196,8 +196,15 @@ Multiple blocks in a cell
196196+------------------+-----------+------------+
197197| # col 1 | # col 2 | # col 3 |
198198| col 1 | col 2 | col 3 |
199−+------------------+-----------+------------+
199++------------------+-----------+------------+
200200| r1 a | - b | c |
201−| | - b 2 | c 2 |
202−| r1 bis | - b 2 | c 2 |
201+| | - b 2 | c 2 |
202+| r1 bis | - b 2 | c 2 |
203203+------------------+-----------+------------+
204+
205+Empty cells
206+
207++---+---+
208+| | |
209++---+---+
210+