@@ -680,12 +680,8 @@ museAppendElement element tbl =
680680 MuseFooterRow row -> tbl{ museTableFooters = row : museTableFooters tbl }
681681 MuseCaption inlines -> tbl{ museTableCaption = inlines }
682682
683−tableCell :: PandocMonad m => MuseParser m (F Blocks)
684−tableCell = try $ fmap B.plain . trimInlinesF . mconcat <$> manyTill inline (lookAhead cellEnd)
685− where cellEnd = try $ void (many1 spaceChar *> char '|') <|> eol
686−
687683tableElements :: PandocMonad m => MuseParser m (F [MuseTableElement])
688−tableElements = sequence <$> (tableParseElement `sepEndBy1` eol)
684+tableElements = sequence <$> many1 tableParseElement
689685
690686elementsToTable :: [MuseTableElement] -> MuseTable
691687elementsToTable = foldr museAppendElement emptyTable
@@ -704,10 +700,10 @@ tableParseElement = tableParseHeader
704700tableParseRow :: PandocMonad m
705701 => Int -- ^ Number of separator characters
706702 -> MuseParser m (F [Blocks])
707−tableParseRow n = try $
708− sequence <$> (tableCell `sepBy2` fieldSep)
709− where p `sepBy2` sep = (:) <$> p <*> many1 (sep *> p)
710− fieldSep = many1 spaceChar *> count n (char '|') *> (void (many1 spaceChar) <|> void (lookAhead newline))
703+tableParseRow n = try $ sequence <$> tableCells
704+ where tableCells = (:) <$> tableCell sep <*> (tableCells <|> fmap pure (tableCell eol))
705+ tableCell p = try $ fmap B.plain . trimInlinesF . mconcat <$> manyTill inline' p
706+ sep = try $ many1 spaceChar *> count n (char '|') *> (void (many1 spaceChar) <|> void (lookAhead eol))
711707
712708-- | Parse a table header row.
713709tableParseHeader :: PandocMonad m => MuseParser m (F MuseTableElement)
@@ -726,7 +722,7 @@ tableParseCaption :: PandocMonad m => MuseParser m (F MuseTableElement)
726722tableParseCaption = try $ fmap MuseCaption . trimInlinesF . mconcat
727723 <$ many spaceChar
728724 <* string "|+"
729− <*> many1Till inline (try $ string "+|")
725+ <*> many1Till inline (try $ string "+|" *> eol)
730726
731727-- ** Inline parsers
732728