git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: fix parsing of empty cells
d3b2161Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -703,7 +703,7 @@ tableParseRow :: PandocMonad m
703tableParseRow n = try $ sequence <$> tableCells
703tableParseRow n = try $ sequence <$> tableCells
704 where tableCells = (:) <$> tableCell sep <*> (tableCells <|> fmap pure (tableCell eol))
704 where tableCells = (:) <$> tableCell sep <*> (tableCells <|> fmap pure (tableCell eol))
705 tableCell p = try $ fmap B.plain . trimInlinesF . mconcat <$> manyTill inline' p
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))
706+ sep = try $ many1 spaceChar *> count n (char '|') *> (void (lookAhead $ many1 spaceChar) <|> void (lookAhead eol))
707
707
708-- | Parse a table header row.
708-- | Parse a table header row.
709tableParseHeader :: PandocMonad m => MuseParser m (F MuseTableElement)
709tableParseHeader :: PandocMonad m => MuseParser m (F MuseTableElement)
test/Tests/Readers/Muse.hs+11
@@ -891,6 +891,17 @@ tests =
891 [[plain "", plain "Foo"],
891 [[plain "", plain "Foo"],
892 [plain "", plain ""],
892 [plain "", plain ""],
893 [plain "bar", plain ""]]
893 [plain "bar", plain ""]]
894+ , "Empty cell in the middle" =:
895+ T.unlines
896+ [ " 1 | 2 | 3"
897+ , " 4 | | 6"
898+ , " 7 | 8 | 9"
899+ ] =?>
900+ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0), (AlignDefault, 0.0)]
901+ []
902+ [[plain "1", plain "2", plain "3"],
903+ [plain "4", mempty, plain "6"],
904+ [plain "7", plain "8", plain "9"]]
894 ]
905 ]
895 , testGroup "Lists"
906 , testGroup "Lists"
896 [ "Bullet list" =:
907 [ "Bullet list" =: