@@ -1029,22 +1029,29 @@ simpleTableFooter = try $ simpleTableSep '=' >> blanklines
1030-- Parse a raw line and split it into chunks by indices.
1030-- Parse a raw line and split it into chunks by indices.
1031simpleTableRawLine :: Monad m => [Int] -> RSTParser m [String]
1031simpleTableRawLine :: Monad m => [Int] -> RSTParser m [String]
1032−simpleTableRawLine indices = do
1032+simpleTableRawLine indices = simpleTableSplitLine indices <$> anyLine
1033− line <- many1Till anyChar newline
1033+
1034− return (simpleTableSplitLine indices line)
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
1036-- Parse a table row and return a list of blocks (columns).
1041-- Parse a table row and return a list of blocks (columns).
1037simpleTableRow :: PandocMonad m => [Int] -> RSTParser m [Blocks]
1042simpleTableRow :: PandocMonad m => [Int] -> RSTParser m [Blocks]
1038simpleTableRow indices = do
1043simpleTableRow indices = do
1039 notFollowedBy' simpleTableFooter
1044 notFollowedBy' simpleTableFooter
1040 firstLine <- simpleTableRawLine indices
1045 firstLine <- simpleTableRawLine indices
1041− colLines <- return [] -- TODO
1046+ conLines <- many $ simpleTableRawLineWithEmptyCell indices
1042− let cols = map unlines . transpose $ firstLine : colLines
1047+ let cols = map unlines . transpose $ firstLine : conLines ++
1048+ [replicate (length indices) ""
1049+ | not (null conLines)]
1043− mapM (parseFromString (mconcat <$> many plain)) cols
1050+ mapM (parseFromString parseBlocks) cols
1045simpleTableSplitLine :: [Int] -> String -> [String]
1052simpleTableSplitLine :: [Int] -> String -> [String]
1046simpleTableSplitLine indices line =
1053simpleTableSplitLine indices line =
1047− map trim
1054+ map trimr
1048 $ tail $ splitByIndices (init indices) line
1055 $ tail $ splitByIndices (init indices) line
1050simpleTableHeader :: PandocMonad m
1057simpleTableHeader :: PandocMonad m
@@ -1125,7 +1132,8 @@ hyphens = do
1126escapedChar :: Monad m => ParserT [Char] st m Inlines
1133escapedChar :: Monad m => ParserT [Char] st m Inlines
1127escapedChar = do c <- escaped anyChar
1134escapedChar = do c <- escaped anyChar
1135+ return $ if c == ' ' || c == '\n' || c == '\r'
1128− return $ if c == ' ' -- '\ ' is null in RST
1136+ -- '\ ' is null in RST
1129 then mempty
1137 then mempty
1130 else B.str [c]
1138 else B.str [c]