@@ -1029,22 +1029,29 @@ simpleTableFooter = try $ simpleTableSep '=' >> blanklines
10291029
10301030-- Parse a raw line and split it into chunks by indices.
10311031simpleTableRawLine :: Monad m => [Int] -> RSTParser m [String]
1032−simpleTableRawLine indices = do
1033− line <- many1Till anyChar newline
1034− return (simpleTableSplitLine indices line)
1032+simpleTableRawLine indices = simpleTableSplitLine indices <$> anyLine
1033+
1034+simpleTableRawLineWithEmptyCell :: Monad m => [Int] -> RSTParser m [String]
1035+simpleTableRawLineWithEmptyCell indices = try $ do
1036+ cs <- simpleTableRawLine indices
1037+ let isEmptyCell = all (\c -> c == ' ' || c == '\t')
1038+ guard $ any isEmptyCell cs
1039+ return cs
10351040
10361041-- Parse a table row and return a list of blocks (columns).
10371042simpleTableRow :: PandocMonad m => [Int] -> RSTParser m [Blocks]
10381043simpleTableRow indices = do
10391044 notFollowedBy' simpleTableFooter
10401045 firstLine <- simpleTableRawLine indices
1041− colLines <- return [] -- TODO
1042− let cols = map unlines . transpose $ firstLine : colLines
1043− mapM (parseFromString (mconcat <$> many plain)) cols
1046+ conLines <- many $ simpleTableRawLineWithEmptyCell indices
1047+ let cols = map unlines . transpose $ firstLine : conLines ++
1048+ [replicate (length indices) ""
1049+ | not (null conLines)]
1050+ mapM (parseFromString parseBlocks) cols
10441051
10451052simpleTableSplitLine :: [Int] -> String -> [String]
10461053simpleTableSplitLine indices line =
1047− map trim
1054+ map trimr
10481055 $ tail $ splitByIndices (init indices) line
10491056
10501057simpleTableHeader :: PandocMonad m
@@ -1125,7 +1132,8 @@ hyphens = do
11251132
11261133escapedChar :: Monad m => ParserT [Char] st m Inlines
11271134escapedChar = do c <- escaped anyChar
1128− return $ if c == ' ' -- '\ ' is null in RST
1135+ return $ if c == ' ' || c == '\n' || c == '\r'
1136+ -- '\ ' is null in RST
11291137 then mempty
11301138 else B.str [c]
11311139